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!
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).
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.
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
linearVelocity.VectorVelocity = Vector3.new(0, 0, 0)
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.