here is the code
local part = script.Parent local debounce = false
part.ClickDetector.MouseClick:Connect(function() part.Sign.SurfaceGui.TextLabel.Text = math.random(1, 8) debounce = true wait(6) debounce = false
end)
here is the code
local part = script.Parent local debounce = false
part.ClickDetector.MouseClick:Connect(function() part.Sign.SurfaceGui.TextLabel.Text = math.random(1, 8) debounce = true wait(6) debounce = false
end)
Yes. You're on the right track, you're just not utilizing the debounce correctly.
local part = script.Parent
local debounce = false
part.ClickDetector.MouseClick:Connect(function()
if not debounce then -- This is the check we need.
-- This will check if "debounce" is equal to false; when it is false, run this code, and we change it to true so that it won't activate while on cooldown.
part.Sign.SurfaceGui.TextLabel.Text = math.random(1, 8)
debounce = true
wait(6)
debounce = false
end
end)
Thanks for helping me!
Maybe something like this(Not sure):
CoolDown = false
function Example()
CoolDown = true
part.Sign.SurfaceGui.TextLabel.Text = math.random(1, 8)
Wait(3)
CoolDown = false
end
function Clicked()
if CoolDown == false then
Example()
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
oops
im sorry that i forgot to press enter when i put debounce _ false