Adding force to a player?

Hey again everyone.

I was wondering how I can add force to a play. E.g. throwing them up into the air?

Is this possible server-side? If not, then is it clientside?

Any help is appreciated :smiley:

  • Fillipuster

When you say you want force to be applied, do you want it to be a console command or a SWEP?

I want a player to be pushed in a direction uppon spawning. Not a command or a SWEP.
Sorry for not specifying :frowning:

PhysObj:ApplyForceCenter

Here’s a peice of code that’ll rocket a player upwards (probably need to use SetVelocity)

Put this anywhere serverside.


hook.Add("PlayerSpawn",function(Player)
	if(!IsValid(Player)) then return end

	timer.Simple(2.5, function()
		local phys = Player:GetPhysicsObject()
		local force = phys:GetMass() * 150
		Player:SetVelocity(Vector(0,0,force))
	end)
end)

Does ApplyForceCenter work on players? The old wiki says it doesn’t

I don’t know, that’s why I suggested SetVelocity too as I am almost 100% certain that works on players.

Setvelocity.

Used it several times

I updated the piece of code I posted.