How to make an advanced Gui opening script?

How do I make a more advanced script of this:

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Gui.Visible = not script.Parent.Gui.Visible
end)
2 Likes

I suggest to use TweenService, with that you can do more advanced Gui and more, you can find a lot of tutorials about on YouTube

Here is one

2 Likes

I mean like if I used this script, It could be spammed clicked and it would not work well if I associated an other script to it.

1 Like

You can add a Debounce to solve the spam issue

2 Likes

You could add a debounce, which is essentially a cool down. Before running the code check if the cool down is done.

local debounce = false
        
script.Parent.MouseButton1Click:Connect(function()
        if debounce == false then
                debounce = true  
                script.Parent.Gui.Visible = not script.Parent.Gui.Visible
                wait(0.3)
                debounce = false
         end
end)
2 Likes