Climb SWEP

That’s the error I get when I use the Climb SWEP, i’m not sure what it means.


weapons\climb_swep\shared.lua:46: attempt to call method 'SetVelocity' (a nil value)

It means it doesnt know what SetVelocity is. Its nil.

How do I go about fixing this? Or know any lua docs which can help me?

function SWEP:PrimaryAttack()
	local pos = self.Owner:GetShootPos()
	local ang = self.Owner:GetAimVector()
	local tracedata = {}
	tracedata.start = pos
	tracedata.endpos = pos+(ang*25)
	tracedata.filter = self.Owner
	local trace = util.TraceLine(tracedata)
	if ( trace.HitWorld or trace.Entity:IsValid() ) then
	    local Vel = self.Owner:GetVelocity()
		self.Owner:SetVelocity(Vector(0,0,300-Vel.z)) --This is the error line
	end
	self.Weapon:SetNextPrimaryFire( CurTime() + self.Delay )
end

I think the problem is that SetVelocity hasn’t been defined yet in that code.