#My dash script isn't working

1 messages · Page 1 of 1 (latest)

gusty mica
#

Can someone help with my dash script, I tried to dash in game and it says "attempt to index nill with 'max force'" can someone tell me what that means

edgy vessel
copper roost
#

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

edgy vessel
copper roost
#

ah

#

well glad to help

gusty mica
gusty mica
sleek echoBOT
#

studio** You are now Level 1! **studio