So I need to control a manhack npc based on the left mouse button. The mouse button part works it’s just that most of my methods of getting the npc manhack to move have crashed the server.
These attempts have included applyforce and Ent:SetVector ( same as the code below except a change to mhent:SetVelocity )
function KeyPressed (ply, KEY_LEFT ) local traceRes = ply:GetEyeTrace() while ply:KeyReleased( KEY_LEFT ) != true do Msg ("KAOOM AND THE STAIN IS GONE ") --dev message local mhent = ents.FindByName( "plymanhack-" .. ply:Nick() ) --the manhacks name mhent:GetPhysicsObject():ApplyForceCenter( traceRes.HitPos ) end end
All I want to know is how to get a manhack to budge towards any Pos while left mouse is pressed