I want to create a robust forward dash/roll that will bring the player forward. I’ve tried a couple methods, but they all end up going too far when the player is in the air compared to the short distance they travel on land. I used BodyVelocity and a CFrame loop, but they both did not yield good results.
Anyone know a good method for dashing that will travel the same distance no matter what physics or friction the player is under? I don’t want players to travel 20 studs just because they dashed in the air.
Maybe, making an animation for it will work for your needs. That way the player that is dashing will always have the same travel distance and “movements” with no ( or little to non) interaction with physics.
If I set the humanoid’s PlatformStanding to true, wouldn’t it just flop on to the floor while dashing? If I pair this with BodyVelocity, it would also just kinda fling forward. What do you suggest I pair PlatformStanding true with to push the player forward?
Instead of using BodyVelocity, set the player’s root velocity to a certain value to move them forward.
-- setting the character and speed of dash
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local vel = 300
-- grabbing the User Input Service
local UserInputService = game:GetService("UserInputService")
-- detecting when they want to dash
local can_dash = true
local cooldown = 3
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
if can_dash == true then
Char.HumanoidRootPart.Velocity = char.HumanoidRootPart.CFrame.lookVector * vel
can_dash = false
wait(cooldown)
can_dash = true
end
end
if plr_wants_to_dash then -- detect when they want to dash (can use UserInputService)
Char.HumanoidRootPart.Velocity = char.HumanoidRootPart.CFrame.lookVector * vel
end
This definitely dashes, but it goes back to my original issue, which is that players move farther in the air than on ground because of the friction. Check the GIF below to see what I mean.
I haven’t tried it with TweenService, but I have done it with a CFrame for loop. If I use TweenService, would I be able to keep it only on the Z and X axis, so that the player can move with gravity while dashing?
But with an AnimationTrack, the HumanoidRootPart does not follow where the animation goes. For example, my camera wouldn’t move with the player, and if I used mouselock I could change the dash’s direction midway, which is pretty weird.
Hmm… I don’t want the dash to ignore gravity completely. I think what I need is a BodyPosition mover that ignores the Y axis, would this be possible? I know the type of dash I’m looking for is possible, as I’ve seen it in games before.