• Help with error code i keep getting!
    2 replies, posted
So i am working on a code and i seem to be having trouble with this one part. So the code says --------------------------------------------------------------------------------------- function SWEP:SecondaryAttack() local trace = { } trace.start = self.Owner:EyePos(); trace.endpos = trace.start + self.Owner:GetAimVector() * 95; trace.filter = self.Owner; local tr = util.TraceLine( trace ); if ( tr.Entity:IsValid() and ( tr.Entity:IsPlayer() ) ) then if( tr.Entity:GetNWBool( "FrozenYay" ) == true ) then tr.Entity:SetNWBool( "FrozenYay", false ) tr.Entity:SetWalkSpeed(160) tr.Entity:SetRunSpeed(240) tr.Entity:Give("Money Bag") tr.Entity:Give("gmod_camera") tr.Entity:Give("gmod_tool") self.Owner:EmitSound("npc/metropolice/vo/getoutofhere.wav", 50, 100) tr.Entity:EmitSound("npc/metropolice/vo/getoutofhere.wav", 50, 100) else self.Owner:PrintMessage( HUD_PRINTCENTER, "Player isn't handcuffed." ); tr.Entity:PrintMessage(HUD_PRINTCENTER,"You Have Been Released."); end end end --------------------------------------------------------------------------------------- But everytime i look at a player and right click i get an error saying [ERROR] addons/swatgear/lua/weapons/handcuffs/shared.lua:164: attempt to call method 'Give' (a nil value) 1. unknown - addons/swatgear/lua/weapons/handcuffs/shared.lua:164 Anyone know how i can give weapons to the player with out getting this error?
Player.Give is only available to the server. Post in the right section next time.
Swep code is used by clientside, so you need to send data to server with "net" commands.
Sorry, you need to Log In to post a reply to this thread.