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

How would I make a button that hides/shows a GUI?

Asked by 10 years ago

I was trying to make something for Innovation Inc. using surface GUI's. It is a television with surface GUI on it. It came with a button that closed the GUI. The GUI never respawned. I looked at the script and I tried to think of a code but it wouldn't work. Can someone give me a code so I can have it respawn back? Thanks if you do! :)

0
Please include the code for the script that closed the GUI. Unclear 1776 — 10y

5 answers

Log in to vote
2
Answered by 10 years ago

GuiObjects have a Visible property, which is a boolean (true or false). Simply set this to your desired visibility standard.

0
Depending on the script it may also have been deleted, I usually use this when working with tutorials that I dont want poping back up every time the player respawns Dezozion 0 — 5y
Ad
Log in to vote
0
Answered by 10 years ago

If you :Destroy() or :Remove() the GUI then you will need to recreate the GUI again using Instance.new()

Also, as Unclear said, "Please include the code for the script that closed the GUI."

0
What do you mean, recreate the GUI? rookie423 0 — 10y
Log in to vote
0
Answered by
piRadians 297 Moderation Voter
5 years ago

GUIObjects have a property called Visible. And there is an event called MouseButton1Down on buttons, which will fire when you click them.

Log in to vote
0
Answered by 4 years ago

but god said

Log in to vote
0
Answered by 3 years ago

pretty simple, create a gui and a frame and text button inside, in a script inside the text button write the code below, that will get rid of the text button when it is pressed. You could create another frame with an if statement what makes the other frame visible when the button and other frame is invisible. It will be something like this.

-- function
script.parent.MouseButton1Click:Connect(function() -- does a function
script.parent.parent.visible = false -- makes the textbuttons parent (frame) invisible
end)

-- if statement (this if statement makes it so if the first frame is invisible the new 1 will be visible)
if script.parent.parent.visible = false then
game.StarterGui.ScreenGui.Frame2.visible = false
end

Answer this question