Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Dash Mechanic Knows No Cooldown Help?

Okay so heres the brief explanation I made a dashing Script right but I cant seem to get it to function the way intended to so I want to make it have a cooldown script but its not working it either Only Dashes Once then completely breaks or if I remove the cooldown it'll just dash for infinitely I dont know what the issue...

local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local cooldown = false

local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=04907165430" 

mouse.KeyDown:connect(function(key)
  if cooldown == true then return end
    if string.byte(key) == 113 then
      cooldown = true 
        local playAnim = humanoid:LoadAnimation(anim)
        playAnim:Play()
        script.Sound:Play()
        player.Character.HumanoidRootPart.Velocity = player.Character.HumanoidRootPart.CFrame.lookVector * 50
        wait(0.1) 
      cooldown = true
    end
    wait(0.5)
end)

1 answer

set line 19's cooldown to false, that might be the problem

you did not set the cooldown back to false as it is needed for the script to run (get past line 11), and setting the wait(0.1) a little higher would make the cooldown a little more visible

This discussion is preserved as it was. New answers, comments, and votes are closed.