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)
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