SWEP models messed up

Hello guys! Before i get into this i want to say i have never worked with sweps so if this is a simple problem dont get mad this is my first swep thanks!

Im using this to put the models in place… No heres the bug…

heres my code

Now the bug if the video does not explain is there is a model thats in the players face when they move too fast… And there is a model in the body of the player.

Please help! Thanks!

It appears that your setting the world model and the view model as the model as well. Because they have no bones they just default to the origin. Try using an actual weapon model and making them invisible.

How would i do this… again i have NEVER worked with sweps and models…

You said you were using the SCK if you set the view model to something like ‘models/weapons/v_pistol.mdl’ and the world model to something like ‘models/weapons/w_pistol.mdl’ and click the hide button for both the view model and world model that should work.

Well it needs a world model so other people can see the key…

You see these four values:


SWEP.ViewModel = "models/spartex117/key.mdl"
SWEP.WorldModel = "models/spartex117/key.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = true

Change them to this:


SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
SWEP.ShowViewModel = false
SWEP.ShowWorldModel = false

We make the base models invisible because we are adding the keys afterwards with this piece of code which you have already setup:


self.VElements = {
    ["models/spartex117/key.mdl"] = { type = "Model", model = "models/spartex117/key.mdl", bone = "static_prop", rel = "", pos = Vector(3.635, -5.715, -9.87), angle = Angle(0, -90, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
self.WElements = {
    ["models/spartex117/key.mdl1"] = { type = "Model", model = "models/spartex117/key.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.635, 0.518, 0.518), angle = Angle(0, -90, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}

There is also a material that no longer exists which is used to make the base view model invisible:


if (self.ShowViewModel == nil or self.ShowViewModel) then
    vm:SetColor(Color(255,255,255,255))
else
    // we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called
    vm:SetColor(Color(255,255,255,1))
    // ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in
    // however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing
    vm:SetMaterial("Debug/hsv")
end

And then change the material to “vgui/hsv” and it should look like this:


if (self.ShowViewModel == nil or self.ShowViewModel) then
    vm:SetColor(Color(255,255,255,255))
else
    // we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called
    vm:SetColor(Color(255,255,255,1))
    // ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in
    // however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing
    vm:SetMaterial("vgui/hsv")
end

If non of this works I could set the key up as a proper view model and world model for you.