I'm making a Gui that Tweens 2 Frames at different intervals. When the player presses the Gui activation button too fast the Frames become messed up. So I need to be able to disable the activation button for just a few moments. Any Idea on how to do that?
✓ ANSWER ACCEPTED
How do I disable and enable a Gui button?
1 answer
✓ Accepted answer
local Debounce, Delay = true, 5 -- Vars
script.Parent.MouseButton1Click:Connect(function()
if Debounce then -- Checks if boolean is true
print(1) -- Our code to run
Debounce = false
wait(Delay) -- Delay runs
Debounce = true
end
end)
This is called a debounce, this is very useful for many things and especially for your case here If this helps make sure to tell me! Have a great day..
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
OMG! lol I completely forgot about that! Yep worked, thank ya!
no problem, glad i could help.