Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do I Make A Cooldown In My Run GUI?

Asked by
jacobwow 140
10 years ago

This is my run gui script:

patiance = math.random(8,14)

function run()
script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = math.random(18,24)
wait(patiance)
script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = 16
end

script.Parent.MouseButton1Down:connect(run)

1 answer

Log in to vote
1
Answered by 10 years ago

you add debounce !

local debounce
patiance = math.random(8,14)

function run()
if not debounce then
debounce = true
script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = math.random(18,24)
wait(patiance)
script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = 16
debounce = false
end
end

script.Parent.MouseButton1Down:connect(run)

Ad

Answer this question