No matter what, even if I use shiftlock, I can’t dash in any diagonal direction using left. The game doesn’t even register me attempting to dash. I’ve tried in another script to see if any diagonal using left works and it worked flawlessly. I’ve tried script diagonals individually, but I have the same problem.
wait(1)
local Movement = {
["Sprint"] = function(Player, Params)
end,
["Dash"] = function(Player, Params, UserInput)
local RS = game:GetService("RunService")
local Debris = game:GetService("Debris")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local HRP = character:FindFirstChild("HumanoidRootPart")
local keys = {
["Forward"] = UserInputService:IsKeyDown(Enum.KeyCode.W),
["Backwards"] = UserInputService:IsKeyDown(Enum.KeyCode.S),
["Right"] = UserInputService:IsKeyDown(Enum.KeyCode.D),
["Left"] = UserInputService:IsKeyDown(Enum.KeyCode.A)
}
local roll = {
ForwardRoll = humanoid:LoadAnimation(script:WaitForChild("ForwardRoll")),
BackwardsRoll = humanoid:LoadAnimation(script:WaitForChild("BackwardsRoll")),
RightDash = humanoid:LoadAnimation(script:WaitForChild("RightDash")),
LeftDash = humanoid:LoadAnimation(script:WaitForChild("LefttDash"))
}
local duration = roll.ForwardRoll.Length
local _, pitch, _ = HRP.CFrame:ToOrientation()
local bodyVelocities = {}
local ShiftLocked = false
local function Velocity(multiplier, velocity)
multiplier = 0
if keys["Forward"] then
multiplier = 3.125
print("F")
elseif keys["Backwards"] then
multiplier = -3.125
print("B")
elseif keys["Right"] then
multiplier = 3.125
print("R")
elseif keys["Left"] then
multiplier = -3.125
print("L")
end
velocity = humanoid.WalkSpeed * multiplier
return velocity
end
local velocity = humanoid.WalkSpeed * 3.125
local calculatedVelocity = Velocity(0, keys)
local function Roll()
if humanoid.FloorMaterial ~= Enum.Material.Air then
humanoid.UseJumpPower = false
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(99999,0,99999)
bodyVelocity.Parent = HRP
if not ShiftLocked then
bodyVelocity.Velocity = HRP.CFrame.LookVector * velocity * 10 / humanoid.WalkSpeed
elseif keys["Right"] or keys["Left"] and ShiftLocked then
bodyVelocity.Velocity = HRP.CFrame.RightVector * calculatedVelocity * 10 / humanoid.WalkSpeed
elseif keys["Forward"] or keys["Backwards"] and ShiftLocked then
bodyVelocity.Velocity = HRP.CFrame.LookVector * calculatedVelocity * 10 / humanoid.WalkSpeed
end
table.insert(bodyVelocities, bodyVelocity)
while roll.ForwardRoll.isPlaying or roll.BackwardsRoll.isPlaying or roll.RightDash.isPlaying or roll.LeftDash.isPlaying do
local _, newPitch, _ = HRP.CFrame:ToOrientation()
if pitch ~= newPitch then
if #bodyVelocities > 0 then
bodyVelocities[#bodyVelocities]:Destroy()
table.remove(bodyVelocities, #bodyVelocities)
end
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(99999,0,99999)
bodyVelocity.Parent = HRP
if not ShiftLocked then
bodyVelocity.Velocity = HRP.CFrame.LookVector * velocity * 10 / humanoid.WalkSpeed
elseif keys["Right"] or keys["Left"] and ShiftLocked then
bodyVelocity.Velocity = HRP.CFrame.RightVector * calculatedVelocity * 10 / humanoid.WalkSpeed
elseif keys["Forward"] or keys["Backwards"] and ShiftLocked then
bodyVelocity.Velocity = HRP.CFrame.LookVector * calculatedVelocity * 10 / humanoid.WalkSpeed
end
table.insert(bodyVelocities, bodyVelocity)
end
wait(0.05)
end
bodyVelocities[#bodyVelocities].Velocity *= 0.9
humanoid.UseJumpPower = true
for _, bodyVelocity in ipairs(bodyVelocities) do
bodyVelocity:Destroy()
end
end
end
local function Shiftlocked()
if keys["Forward"] then
roll.ForwardRoll:Play()
Roll()
print("forward")
elseif keys["Backwards"] then
roll.BackwardsRoll:Play()
Roll()
print("backward")
elseif keys["Right"] then
roll.RightDash:Play()
Roll()
print("play")
elseif keys["Left"] then
roll.LeftDash:Play()
Roll()
print("play")
end
end
if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
ShiftLocked = true
Shiftlocked()
elseif UserInputService.MouseBehavior == Enum.MouseBehavior.Default or UserInputService.MouseBehavior == Enum.MouseBehavior.LockCurrentPosition then
ShiftLocked = false
roll.ForwardRoll:Play()
Roll()
end
end,
}
return Movement