Making a dash/roll with Humanoid.MoveDirection and struggling with how it interacts with being in the air

Right now I’m trying to make a dash that functions similarly to below:


(Credits: Deepwoken by Monad Studios)

I’m not even a little bit familiar with using any of the physics objects in Roblox studio so I decided to test out LinearVelocity, since that is what many other posts on making dashes recommended. Unfortunately I’m running into two pretty glaring issues.


The first one is that the “dash” I made more or less suspends the user in the air, whether or not they are moving in a direction. I would personally like to only change the horizontal (X and Z axes) velocity while leaving the vertical untouched.

The second, arguably more pressing issue is the fact that in addition to suspending the user in the air, the “dash” propels the user MUCH further forwards while airborne (as can be seen in the video), but when the user is on the ground, the force is pretty much unnoticeable.

Any help resolving these two issues, or perhaps providing an alternative method that better fits my specifications would be greatly appreciated, and the script that I am currently using to test this method is detailed below.

Hum = script.Parent:FindFirstChild("Humanoid")
Force = 40
while true do
	print(Hum.MoveDirection)
	local BodyVel = Instance.new("LinearVelocity")
	BodyVel.Parent = Hum.Parent:FindFirstChild("HumanoidRootPart")
	BodyVel.Attachment0 = BodyVel.Parent.RootAttachment
	BodyVel.MaxForce = 5000
	BodyVel.VectorVelocity = Hum.MoveDirection * Force
	wait(1)
	BodyVel:Destroy()
	wait(1)
end

This script is parented to the player’s character and is meant to fire a “dash” every 2 seconds or so. (I know that decreasing the time between the creation of the body velocity and the destruction makes the player hang in the air for a shorter period of time, but ideally I’d like for there to be no time hanging in the air)

1 Like

for your second issue with being propeled much further in the air vs on the ground has to do with friction. honestly the easiest way i can think to fix this would be to test wether or not the character is in the air and then adjust the speed accordingly if they are. like if Humanoid.FloorMaterial == Enum.Material.Air then lower the speed else keep the speed normal.

1 Like

The first issue, the floating, is solved by setting the LinearVelocity to the plane mode (only effect 2 axis) and setting them to only effect the X and Y plane.

The second may be because it’s actually a VectorForce instead of a LinearVelocity. VectorForces allow other forces such as friction to effect the total velocity, making it slow on the ground and fast in the air.

Note that since a VectorForce applies a force, the time it’s active isn’t the same as the time the target is being pushed.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.