• Problem with swep Lua setpos
    2 replies, posted
I made swep to teleport players to a room and i don't know how to fix it. Error message: "attempt to call global 'vector' (a nil value)" in lineent:setPos(vector(10618,-3836,-669)). Someone can help me with fix that problem? Immediately thank you for all the efforts. function SWEP:PrimaryAttack() if not IsFirstTimePredicted() then return end if self.NextAttackW > CurTime() then return end self.NextAttackW = CurTime() + self.AttackDelay if SERVER then local ent = self.Owner:GetEyeTrace().Entity if not (ent:GetPos():Distance(self.Owner:GetPos()) < 80) then return end if not ent:IsPlayer() then return end local weapon = ent:GetActiveWeapon() if weapon and weapon.ISSCP then return end if not ent:Alive() then return end ent:setPos(vector(10618,-3836,-669)) end end
You didn't write the vector function correctly. vector != Vector also SetPos, not setPos ent:SetPos( Vector( -10618, -3836, -669 ) )
Thank you very much. Works
Sorry, you need to Log In to post a reply to this thread.