How to make an open button for a GUI
1) Make the GUI
Lets make a screen gui inside “Starter Gui” | game.StarterGui
2) Make a button and a frame
Inside the Screen Gui that you just made, make a frame. You can design the frame however you want. Once you done make a frame, make a button inside the Screen Gui. You can design and name them however you want. Make sure to make the frame invisible (properties > Visible) so it will actually work.
3) Make a local script inside the button
4) Let’s script!
Paste inside the LocalScript the following code:
local frame = script.Parent.Parent.Frame -- The frame that we made
local button = script.Parent -- Our open button
button.MouseButton1Down:Connect(function() -- Whenever the player clicks the button
frame.Visible = true -- Sets our frame visible to true. true = visible, false = not visible
end)
5) We’re done!
Now whenever you’ll click on your button, the frame will appear!
We can also make it toggleable!
If you want to make the button toggleable, paste the following script instead of the code that we made:
local frame = script.Parent.Parent.Frame -- The frame that we made
local button = script.Parent -- Our open button
button.MouseButton1Down:Connect(function() -- Whenever the player clicks the button
if frame.Visible == false then -- Checks if the frame is not visible
frame.Visible = true -- makes it visible
else -- The toggle
frame.Visible = false -- Makes the frame invisible
end
end)
Now if you will click the button once, the frame will be visible. However, if you click the button again and the frame is visible then it will make the frame invisible!
If you need any help, feel free to ask me!
Thanks for reading