What body mover or constraint should I use for dash?

Hey! I’ve seen A LOT of similar topics, but none of them has a solution. I’m looking for a body mover (they’re deprecated though) or constraints (like VectorForce or AlignPosition), I really have tried everything (even setting friction and weight friction to 0) but nothing works… and I still can’t figure out how a lot of games (Combat Warriors, GPO, etc.) make it successfully.

The issue may change:

  • BodyVelocity, VectorForce or LinearVelocity are have different distances: if you dash while standing (touching the floor) then force will be heavily decreased (friction I think, but already tried to set it to 0), and if you dash in mid-air then force will launch you like a rocket.

  • BodyPosition or AlignPosition go to the desired position without varying, but they ignore gravity or anything else (they “float” in a straight line to the goal)

  • Almost forgot about TweenService, which is not faithful at all (shows stuff very late to the other clients)

Anyone that have done a decent dash in the past? I’d really appreciate your help, thank you for reading!

3 Likes

You said BodyPosition would work but the gravity is the issue, if you set the MaxForce.Y to 0 that should resolve that

1 Like

I thought about the same thing, but there is a solution that isn’t deprecated?

Thank you for replying!

AlignPosition should function similarly in the same way for MaxForce:

1 Like

This doesn’t do absolutely anything (hitpos and the other variables work just fine, since I used them for BodyPosition).

local at0 = Instance.new("Attachment")
at0.Parent = hrp
at0.WorldPosition = hrp.Position

local ap = Instance.new("AlignPosition")
ap.Parent = hrp
ap.Attachment0 = at0
ap.Mode = Enum.PositionAlignmentMode.OneAttachment
ap.Position = hitpos
ap.Responsiveness = 500
ap.MaxForce = Vector3.new(math.huge,0,math.huge)
ap.MaxVelocity = 500
ap.RigidityEnabled = true
		
game.Debris:AddItem(at0,0.3)
game.Debris:AddItem(ap,0.3)

Thank you for replying!

This is the way to go. LinearVelocity controls the velocity while it’s active. If you leave it active for a duration of time, the distance moved is time * velocity (assuming the max force is large enough).

2 Likes

As I said, LinearVelocity (check this topic) pushes on almost the same way as BodyVelocity, so it still gets slower as it moves on the ground. I was going to try to use AlignPosition, but (as you can see in the code above) it doesn’t work.

Thank you for replying!

I have recreated rogue lineages dash if thats something you are looking for.
it worked something like this.

local bp = Instance.new(“BodyPosition”,Character.HumanoidRootPart)
bp.MaxForce = Vector3.new(15000,0,15000)
bp.P = 10000
bp.D = 1000
game:GetService(“RunService”).Stepped:Connect(function()
bp.Position = (Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-15)).Position
end)

2 Likes

Yes, currently I’m using BodyPosition, but it is deprecated. I’m trying to make it using AlignPosition, but it doesn’t seem to work if RigidityEnabled is false.

Thank you for replying!

If you increase the max force I am basically certain this will work. In the topic you linked the OP was using them incorrectly, and the solution solved their problem.

You just need to increase the max force.

1 Like

Put this code in a LocalScript in StarterCharacterScripts:

local UserInputService = game:GetService("UserInputService")

local character = script.Parent
local hrp = character:WaitForChild("HumanoidRootPart")

local function onInputBegan(input, _gameProcessed)
	if input.KeyCode == Enum.KeyCode.Q then
		local attachment = Instance.new("Attachment")
		attachment.Parent = hrp
		
		local linearVelocity = Instance.new("LinearVelocity")
		linearVelocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector -- Could also use line if you dont want the other axises to be affected (rotate attachment)
		linearVelocity.Attachment0 = attachment
		linearVelocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
		linearVelocity.MaxForce = math.huge
		linearVelocity.VectorVelocity = Vector3.new(70, 0, 0)
		linearVelocity.Enabled = true
		linearVelocity.Parent = hrp
		
		task.wait(0.15)
		
		linearVelocity.VectorVelocity = Vector3.new(0, 0, 0)
		
		task.wait(0.01)
		
		linearVelocity:Destroy()
		attachment:Destroy()
	end
end

UserInputService.InputBegan:Connect(onInputBegan)

To make it work only on dash axis change the LinearVelocity to use Line mode and rotate the attachment 90 degrees.

To make the dash more smooth you can use tweening.

To make the character’s animations look nice add a dashing animation while the dash movers are active.

3 Likes

My bad for my late reply, I didn’t see the notification! MaxForce is on math.huge, so that wouldn’t be a problem…

Thank you for replying!

Wait I’m still using BodyPosition in some games is that bad?

1 Like

It is deprecated, check this: BodyPosition | Roblox Creator Documentation

Thank you for replying!

Did you try the code I sent? Did you see the video of it working?

I don’t understand why that doesn’t answer your question. Everyone uses LinearVelocity instances for dashing or custom physics. If you’re going to use a constraint you should be using LinearVelocity.

1 Like

It’s fine. They might start preforming worse, but so many games use them that they’ll probably keep supporting them for a while.

1 Like

How would you go about applying gravity to the velocity so the character isn’t Stuck in the air

You would set the LinearVelocity’s ForceLimitMode to PerAxis then set MaxAxesForce to Vector3.new(math.huge, 0, math.huge).

This makes it so the LinearVelocity has 0 effect on the y axis, which is up and down. This causes it to not override gravity.

1 Like

Worked like a charm. Appreciate the help

1 Like

I’ll try using bodyposition. You just looked at blurred text.