#My dash script isn't working
1 messages · Page 1 of 1 (latest)
Did u just copy that script from somewhere?
i see the problem
here is the script that actually works
uis.InputBegan:Connect(function(key)
if debounce == false then
if key.KeyCode == Enum.KeyCode.W then
local vel = Instance.new("BodyVelocity", HRP)
vel.MaxForce = Vector3.new(math.huge, 0, math.huge)
vel.Velocity = HRP.CFrame.LookVector * 100
game.Debris:AddItem(vel, 0.2)
debounce = true
wait(1)
debounce = false
elseif key.KeyCode == Enum.KeyCode.A then
local vel = Instance.new("BodyVelocity", HRP)
vel.MaxForce = Vector3.new(math.huge, 0, math.huge)
vel.Velocity = HRP.CFrame.RightVector * -100
game.Debris:AddItem(vel, 0.2)
debounce = true
wait(1)
debounce = false
elseif key.KeyCode == Enum.KeyCode.S then
local vel = Instance.new("BodyVelocity", HRP)
vel.MaxForce = Vector3.new(math.huge, 0, math.huge)
vel.Velocity = HRP.CFrame.LookVector * -100
game.Debris:AddItem(vel, 0.2)
debounce = true
wait(1)
debounce = false
elseif key.KeyCode == Enum.KeyCode.D then
local vel = Instance.new("BodyVelocity", HRP)
vel.MaxForce = Vector3.new(math.huge, 0, math.huge)
vel.Velocity = HRP.CFrame.RightVector * 100
game.Debris:AddItem(vel, 0.2)
debounce = true
wait(1)
debounce = false
end
end
end)
the problem was in this code:
if WKey == true then
but we never actually set Wkey,Akey,Skey,Dkey
instead you should do this directly:
if key.KeyCode == Enum.KeyCode.W then
He probably did that somewhere in other piece of the code
I used a tutorial to help me make it
Thank you for helping me fix the code
** You are now Level 1! **