So this is my dashing script and it works great. But I have a problem, where whenever I jump and dash, it dashes longer or further compared to when the I am on the ground
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Jumping then
-- code here (maybe just lower the body velocity)
end
end)
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Landed then
-- code here (raise velocity)
end
end)
try to avoid having to much Connection, use this instead:
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Jumping then
-- code (decrease the velocity multiplier)
elseif new == Enum.HumanoidStateType.Landed or new == Enum.HumanoidStateType.Climbing then
-- code (increase the velocity multiplier)
end
end)
It deals with the issue you have and will save you several headaches later. It will automatically check for any obstructions in the dash direction and pause the dash before collision. Additionally, you can learn from it and write your own.
The other solutions in this thread are very band-aid and don’t tackle the main issue, which is combating friction.
hi, i fixed this 3 days ago after an entire year of torture:
the floor has friction, so one of the fixes is to put the friction to 0, but you have to do this with all the parts
my fix was to use Linear velocity
local attach = Instance.new("Attachment", HumanoidRootPart)
local velocity = Instance.new("LinearVelocity", HumanoidRootPart)
velocity.MaxForce = math.huge
velocity.Attachment0 = attach
velocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
velocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
attach.WorldPosition = hrp.AssemblyCenterOfMass
-- this is for the force being applied, basically the dash
velocity.VectorVelocity = Vector3.new(0,0,-force) -- make sure to make the Z negative to make the dash forward