The dash kinda works, here’s how it looks like:
Now you can clearly see what the issue is, the character is displaced and it looks almost like you’re teleporting and obviously, no one wants this garbage in their game.
Here’s the code that I’ve written that got me that result:
function Default.Dash(player: Player)
local character = player.Character or player.CharacterAdded:Wait()
local root = character:FindFirstChild("HumanoidRootPart") :: BasePart
local human = character:FindFirstChildOfClass("Humanoid")
if not root or not human then
return
end
if connection then
connection:Disconnect()
connection = nil
end
connection = RunService.RenderStepped:Connect(function(dt)
local velocity = root.CFrame.LookVector * 80
local gravityVector = (human.FloorMaterial~=Enum.Material.Air) and Vector3.new(0,0,0) or workspace.Gravity
velocity = velocity + Vector3.new(0, -gravityVector*dt, 0)
root.CFrame = CFrame.lookAt(root.Position + velocity*dt, root.Position + (velocity * Vector3.new(1,0,1)))
end)
task.delay(.3, function()
if connection then
connection:Disconnect()
connection = nil
end
end)
end
Now the reason I’m using CFraming for dashing, is because I think I have a lot more control with this, and generally just to test and play around with stuff so I can learn.
Does anyone know how I could fix this issue, if so, please help!