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

How do you make it so you cant spam a click detector?

my shower keeps turning off and off after spamming it with 10 clicks

1 answer

You would add a debounce so that there was a cooldown between clicks:

local debounce = true
local cooldown = 5 --change to seconds between clicks
script.Parent.ClickDetector.MouseClick:Connect(function()
	if debounce then
		debounce = false
		--do shower script
		wait(cooldown)
		debounce = true
	end
end)

1 comment

0

Thanks for spreading to the world how amazing debounces are.

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