Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is the best way to make a player dash left or right? [closed]

Asked by 5 years ago

I'm trying to make a script to dash left or right. So far it works but not as good as I want.

Dash = function(velocity, anim)
  local bodyV = Instance.new("BodyVelocity", char.HumanoidRootPart)
  bodyV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  bodyV.P = 100
  bodyV.Velocity = velocity * 60
  game.Debris:AddItem(bodyV, 0.2)
  anim:Play()
end

This is the code I'm using. The problem is that if I dash when I'm on the ground I move very little but if I jump and dash I move further. How can I make it so that it always dashes the same distance even if I'm jumping and in the same amount of time?

Closed as Primarily Opinion-Based by User#24403

This question has been closed because it is a discussion about a topic focused on diverse opinions, which isn't a good fit for our Q&A format.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
robocu3 30
5 years ago

You could try not using a BodyVelocity object. Change the Humanoid's statetype to RunningNoPhysics and adjust the HumanoidRootPart's velocity relative to the direction you want to dash.

Ad