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:
1 | print ( "Close button loaded" ) |
3 | window = script.Parent.Parent |
8 | script.Parent.MouseButton 1 Click: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.
1 | print ( "Open button loaded" ) |
3 | window = workspace.ScreenGui:clone() |
6 | window.Parent = Player.PlayerGui |
8 | script.Parent.MouseButton 1 Click: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?