Hello, I want to avoid players spamming the button. The button shows a frame, but I want players to only be able press it every 10 seconds. Is this script correct?
3 Likes
Try this:
local debounce = false
local frame = script.Parent.Parent.Test
script.Parent.MouseButton1Click:Connect(function()
if not debounce then
frame.Visible = true
debounce = true
wait(10)
debounce = false
end
end)
1 Like
Someone had the same question as you but it’s a global cooldown, you can edit it by yourself to make it local!
How could I make a server-wide cooldown? - Help and Feedback / Scripting Support - DevForum | Roblox
Just copy the if os.clock-debounce > 1 then
up to the second to the last end
1 Like