attempt to call method 'SetPlayerHands' (a nil value)
1 replies, posted
I'm sorry if this is an easy fix, but after the gmod update this broke. I would like to know how to PROPERLY fix this, because apparently all my fixes don't work.
The error is this ;
attempt to call method 'SetPlayerHands' (a nil value)
And it shoots errors up like fireworks in my server's console.
Please tell me how to fix it. The exact code where it goes wrong is here
[code]
hook.Call("PlayerSetModel", GAMEMODE, ply)
local oldhands = ply:GetHands()
if IsValid(oldhands) then oldhands:Remove() end
local hands = ents.Create( "gmod_hands" )
if IsValid(hands) then
ply:SetHands(hands)
hands:SetOwner(ply)
ply:SetPlayerHands(ply)
ply:DeleteOnRemove(hands)
hands:Spawn()
[/code]
You can just call ply:SetupHands([ply]) to take care of correctly spawning and assigning the hands.
The optional ply argument is the entity to attach them to (such as a spectator). Otherwise it uses the player you called it on.
Sorry, you need to Log In to post a reply to this thread.