So there’s this dash system i was making but it is a little weird. for some reason whenever you dash fast enough it can get two dashes out of the player?
local uis = game:GetService("UserInputService")
local SS = game:GetService("SoundService")
local DS = game:GetService("Debris")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local rootPart = char:WaitForChild("HumanoidRootPart")
local canDash = false
local dashDirection = ""
uis.InputBegan:Connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Keyboard and not processed then
if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D then
canDash = true
dashDirection = input.KeyCode.Name
end
if input.KeyCode == Enum.KeyCode.Q and canDash == true and dashDirection ~= "" then
canDash = false
local attachment = Instance.new("Attachment", rootPart)
local linVel = Instance.new("LinearVelocity", attachment)
local part = game.ReplicatedStorage:FindFirstChild("Part"):Clone()
part.Parent = workspace
local multiplier
if dashDirection == "W" then
multiplier = CFrame.new(-1,-1,-20)
elseif dashDirection == "A" then
multiplier = CFrame.new(-20,-1,-1)
elseif dashDirection == "S" then
multiplier = CFrame.new(-1,-1,20)
elseif dashDirection == "D" then
multiplier = CFrame.new(20,-1,-1)
end
--local at = hum.Animator:LoadAnimation(script[dashDirection.."DashAnimation"])
--at:Play()
SS.Dash:Play()
part.CFrame = rootPart.CFrame * multiplier
linVel.MaxForce = 99999
linVel.VectorVelocity = (part.Position - rootPart.Position).Unit * Vector3.new(100,0,100)
linVel.Attachment0 = attachment
DS:AddItem(attachment, 0.1)
task.wait(1)
canDash = true
end
end
end)