Ad
Log in to vote
0

What is the best way to push (move) players?

Asked by 22 days ago

I want to make a dodgeball tool that pushes players that are hit by it. What is the best way for me to apply force to a player? I've attempted to use BodyVelocity but it takes a moment before it initiates and as a result, feels inorganic; granted, I may be using it incorrectly.

--Given that I have the humanoid of the player that has been hit
    local pushForce = Instance.new("BodyVelocity")
    pushForce.MaxForce = Vector3.new(1000000,1000000,1000000)
    pushForce.Velocity = (-Humanoid.Parent.HumanoidRootPart.CFrame.lookVector) * 100
    pushForce.Parent = Humanoid.Parent.HumanoidRootPart
    wait(0.25)
    pushForce:Destroy()

Are there better alternatives I can look into? Or should I experiment more with BodyVelocity?

1 answer

Log in to vote
0
Answered by 22 days ago

BodyVelocity would be the best way, although you could experiment with manual tweening or editing the CFrame. The one thing I will say though, if BodyVelocity is too laggy, consider running it on the local side instead of the server side. If you are worried about exploiters, then later on you can add server sided anticheat for stuff like this.

Ad

Answer this question