I don't want a player to keep spamming and keep clicking the sound button. That would be annoying. For example; If a player clicked the sound button, then they will have to wait for it to cool down and then they can click it again. How can do that?
Brick = script.Parent Sound = Brick.Sound function onClicked() Sound:Play() end script.Parent.ClickDetector.MouseClick:connect(onClicked)
You could add a debounce.
Brick = script.Parent Sound = Brick.Sound Debounce = false function onClicked() if not Debounce then -- If the debounce is false Debounce = true -- Change it to true Sound:Play() wait(Sound.TimeLength) -- Wait til it ends Debounce = false -- Change it to false end -- End the if function end script.Parent.ClickDetector.MouseClick:connect(onClicked)