Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make an GUI that opens on pressing a button then closes on second time pressed?

Asked by 2 years ago

Hello, can someone please make me a quick script that I can paste into the TextButton?

Image: https://imgur.com/gallery/pJflVIG

0
I’m not 100% sure if you can do this since I haven’t seen people do this yet but I know how to script an open and close TextButton to close a gui if you need. DrTryarus685 -5 — 2y
0
Next time try to show some sort of understanding so we can know your not just asking people to help you for free. Since it’s your first time I’ll just help you but the second time nobody may help you and your post may be closed. DrTryarus685 -5 — 2y
0
This is technically possible with literally 3 lines of script, i'll post in answers Protogen_Dev 268 — 2y

2 answers

Log in to vote
0
Answered by 2 years ago

If you see this, this script is for a open and close script (so 2 different text buttons not just one since it’s easier to do a open and close.

Put this inside of the Open Button:

local Frame = script.Parent.Parent.Frame — Replace Frame with the name of your Frame.

script.Parent.MouseButton1Click:Connect(function()
if Frame.Visible == false then
Frame.Visible = true
end
end)

Put this inside of the Close Button:

local Frame = script.Parent.Parent.Frame — Again, replace Frame with the name of your Frame.

script.Parent.MouseButton1Click:Connect(function()
if Frame.Visible == true then
Frame.Visible = false
end
end)

Note: Put these 2 different scripts in a LocalScript inside of the Open and Close buttons. Put the open script in the open button and put the close script in the close button.

I hope this helps even though I couldn’t fit your requirements!

0
thanks! this was also helpful! Leon_Bobo 0 — 2y
Ad
Log in to vote
0
Answered by 2 years ago

The fastest way is to make use of this script:

script.Parent.MouseButton1Click:Connect(function()
    TargetFrame.Visible = not TargetFrame.Visible
end)

Note that TargetFrame would have to be changed to your frames local/path.

Answer this question