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

How do I disable and enable a Gui button?

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?

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

2 comments

0

OMG! lol I completely forgot about that! Yep worked, thank ya!

0

no problem, glad i could help.

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