Im tryna make a simple dashing system, but when i dont press anything and press Q it just does the last thing i did instead of DashNeutral
local uis = game:GetService("UserInputService")
local cas = game:GetService("ContextActionService")
local plr = game:GetService("Players").LocalPlayer
local Character = plr.Character
local hum = Character:FindFirstChildOfClass("Humanoid")
local humRP = hum.RootPart
local function Dash(actionName, inputState, _inputObject)
if actionName == "DashNeutral" and inputState == Enum.UserInputState.Begin then
local ForceMulti = 3000
humRP:ApplyImpulse(humRP.CFrame.LookVector * ForceMulti + Vector3.new(0, 0, 0))
print("Nforce")
elseif actionName == "DashForwards" and inputState == Enum.UserInputState.Begin then
local ForceMulti = 3000
humRP:ApplyImpulse(humRP.CFrame.LookVector * ForceMulti + Vector3.new(0, 0, 0))
print("Wforce")
elseif actionName == "DashLeft" and inputState == Enum.UserInputState.Begin then
local ForceMulti = 3000
humRP:ApplyImpulse(humRP.CFrame.RightVector * math.abs(ForceMulti) * -1 + Vector3.new(0, 0, 0))
print("Aforce")
elseif actionName == "DashBackwards" and inputState == Enum.UserInputState.Begin then
local ForceMulti = 3000
humRP:ApplyImpulse(humRP.CFrame.LookVector * math.abs(ForceMulti) * -1 + Vector3.new(0, 0, 0))
print("Sforce")
elseif actionName == "DashRight" and inputState == Enum.UserInputState.Begin then
local ForceMulti = 3000
humRP:ApplyImpulse(humRP.CFrame.RightVector * ForceMulti + Vector3.new(0, 0, 0))
print("Dforce")
end
end
uis.InputBegan:Connect(function(input:InputObject, gameProcessedEvent:boolean)
if gameProcessedEvent then return end
cas:BindActionAtPriority("DashNeutral", Dash, false, 0,Enum.KeyCode.Q)
if input.KeyCode == Enum.KeyCode.W then
cas:BindActionAtPriority("DashForwards", Dash, false, 0,Enum.KeyCode.Q)
end
if input.KeyCode == Enum.KeyCode.A then
cas:BindActionAtPriority("DashLeft", Dash, false, 0,Enum.KeyCode.Q)
end
if input.KeyCode == Enum.KeyCode.S then
cas:BindActionAtPriority("DashBackwards", Dash, false, 0,Enum.KeyCode.Q)
end
if input.KeyCode == Enum.KeyCode.D then
cas:BindActionAtPriority("DashRight", Dash, false, 0,Enum.KeyCode.Q)
end
end)