Can someone tell me why HitNorm keeps returning 'nil' no matter if it should have a value or not? I just want this STool to pull the player towards wherever they shoot... continuously.
[CODE]
local HitNorm = nil
function TOOL:LeftClick( trace )
HitNorm = trace.HitNormal
//print(trace.HitNormal) returns a vector?
return true
end
function TOOL:Think()
if ( HitNorm == nil ) then return end //It's always nil?
self:GetOwner():SetVelocity( HitNorm * -1000 )
end
[/CODE]
[CODE]TOOL.HitNorm = nil
function TOOL:LeftClick( trace )
self.HitNorm = trace.HitNormal
//print(trace.HitNormal) returns a vector?
return true
end
function TOOL:Think()
if ( self.HitNorm == nil ) then return end //It's always nil?
self:GetOwner():SetVelocity( self.HitNorm * -1000 )
end
[/CODE]
Sorry, you need to Log In to post a reply to this thread.