I’m trying to add a debounce to my fireball with a number value. When it turns 0 you should be able to fire the event which fires the fireball. But, for some reason it’s not working. Any idea what could be wrong?
Script:
local Debounce = script:WaitForChild("CoolDownValue")
Debounce = math.clamp(Debounce.Value,0,10)
while wait(1) do
Debounce -= 1
end
--User input
if Debounce == 0 then
Event:FireServer(mouse.hit.p)
wait(0.01)
Debounce = 10
local Debounce = script:WaitForChild("CoolDownValue")
Debounce = math.clamp(Debounce.Value,0,10)
for i = Debounce,0,-1 do
Debounce = i
wait(1)
end
--User input
Event:FireServer(mouse.hit.p)
wait(0.01)
Debounce = 10
You can put the texlabel or whatever you use to measure how much is left in the loop.