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

How do I make a menu button where you click it and it opens a GUI?

Asked by 6 years ago

So, I've been making a game, but I can't figure out how to make a Menu Button. Do I add a TextButton to the workspace and put a script inside it to show the GUI?

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Roblox Wiki link: http://wiki.roblox.com/index.php?title=Intro_to_GUIs

I recommend getting help on scripting from ScriptingHelpers.org which is here xD, from Roblox wiki, or from the forums.

Instructions:

1. Add a TextButton and place it where you want in the Gui.

2. Add a LocalScript and place it in the button.

3. Place the GUI in StarterGui

script.Parent.MouseButton1Click:Connect(function(onClick) --Creates a function when clicked
    script.Parent.Visible = false --Makes the parent [Button] transparent
end)

Fun Fact:

You do not have to do MouseButton1Click you could do MouseButton1Up or MouseButton1Down meaning the same thing.

Extra Help:

script.Parent is the parent of the script. So if the script which is the script is in the 'TextButton' then TextButton is the parent of script so that is how you get script.Parent! Now what if you do script.Parent.Parent? Well, What is the parent of TextButton... If you have no frame it is the gui so script.Parent.Parent is the parent of TextButton which is the GUI.

script.Parent is in TextButton and it also could mean anything else in TextButton. You could have another script in TextButton and Disable it so you will use script.Parent.SCRIPTNAME.ANYTHINGinPROPERTY

Please accept my answer if it works :D

Have a Blessed Day, -Goldenkings11

0
MouseButton1Click, MouseButton1Up, and MouseButton1Down is not the same thing. Let me clarify: MouseButton1Click is fired when the mouse has fully clicked the GUI object. MouseButton1Up is when the mouse has released the GUI object, and MouseButton1Down is when the mouse is still clicking on the GUI object. Andorks 23 — 6y
0
Do I just put a button into a GUI and put it on in the starter guis? Welovegod1029384756 25 — 6y
0
Yes, place a TextButton in the GUI and put the GUI in starter GUI and place a local script in the TextButton and paste my script and edit it like you want :) Goldenkings11 -11 — 6y
Ad

Answer this question