I am making a gui book for a group. I made five textbuttons, and I already made a close button that closes. But how do I make another that can make it appear?
Close button's script:
print("Close button loaded") window = script.Parent.Parent function onClicked(GUI) window:remove() end script.Parent.MouseButton1Click:connect(onClicked)
And I also need a open button script that can make gui appear.
Instead of using :remove() or :Destroy() I would recommend using the Visible property which is present in Frames, TextLables etc
Assuming "window" is a Frame and not a ScreenGui I would do this:
print("Close button loaded") window = script.Parent.Parent function onClicked(GUI) window.Visible = false end script.Parent.MouseButton1Click:connect(onClicked)
Where it says "window.Visible = false" you can change to true and it will become visible again.
Now assuming that this is a ScreenGui and you want to use :remove() I suggest keeping a copy of the ScreenGui in Workspace and using :Clone() and parenting it into the players PlayerGui when you need it to be re-opened.
print("Open button loaded") window = workspace.ScreenGui:clone() function onClicked(GUI) window.Parent = Player.PlayerGui --assuming you already have Player declared end script.Parent.MouseButton1Click:connect(onClicked)
Locked by User#19524
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?