The dash works fine in all directions except directly back when you're shift locking. Without shift locking, it works completely fine.
Any good solutions?
Local Script
local UIS = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local dashAnim = script:WaitForChild("Rolling")
--Settings
local key = Enum.KeyCode.Q
local velocity = 13000 -- Dash Speed
local debounce = false
local cooldown = 0.5
local duration = 0.22 -- Dash Duration
local function Dash()
local character = player.Character
if character and not debounce then
debounce = true
local humanoid = character:WaitForChild("Humanoid")
local hrp = character:WaitForChild("HumanoidRootPart")
local loadedDashAnim = humanoid:LoadAnimation(dashAnim)
local dashDirection = nil
local moveDirection = humanoid.MoveDirection
local lookVector = hrp.CFrame.LookVector
local minusVelocity = -velocity
local onGround = humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.FloorMaterial ~= Enum.Material.Water
if onGround then
if moveDirection == Vector3.new(0, 0, 0) then
dashDirection = hrp.Position + Vector3.new(lookVector.X, 0, lookVector.Z)
else
dashDirection = hrp.Position + Vector3.new(moveDirection.X, 0, moveDirection.Z)
end
local bodyGyro = Instance.new("BodyGyro")
bodyGyro.Parent = hrp
bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
bodyGyro.D = 0
bodyGyro.P = 500000
bodyGyro.CFrame = CFrame.lookAt(hrp.Position, dashDirection)
local attachment = Instance.new("Attachment")
attachment.Parent = hrp
local vectorForce = Instance.new("VectorForce")
vectorForce.Parent = hrp
vectorForce.Attachment0 = attachment
vectorForce.Force = Vector3.new(0, 0, minusVelocity)
loadedDashAnim:Play()
humanoid.AutoRotate = false
wait(duration)
humanoid.AutoRotate = true
vectorForce:Destroy()
bodyGyro:Destroy()
attachment:Destroy()
wait(duration)
loadedDashAnim:Stop()
end
wait(cooldown)
debounce = false
end
end

4 comments
Im not sure if this would change your game's gameplay at all, but you could disable shiftlock.
My game is focused on combat, so I don't think disabiling it would be a good idea.
Watch DevZoid, he has a video on dash movement.
bruh