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

How can i make menu button open and close a gui?

I am currently trying to make any form of a game in Roblox studios, yet I would like to allow when a button is pressed it will open a specific GUI and then when it is clicked again it will then close the same GUI.

Here is the script that I have so far:


script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Frame.Visible = true

end)

Please could someone help? :)

3 comments

0

No

0

Don't help

0

huh?

2 answers

put this in a button as a local script in screengui this will open and close the frame

script.Parent.MouseButton1Click:Connect (function()

	script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible

end)

I have this script that is still working. (Remember that those script are Local Script and must be inserted inside of any button separately)

Open Gui: script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Frame.Visible = true end)

Close Gui: script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Visible = false end)

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