So what if i want a game user interface to dissapear when clicked I know I should use visible :destroy() but is it a better practice to just change its parent to replicated storage?
If you use visible it's bad practice right? Should you instead change its parent to rep storage
1 answer
GUIs themselves cannot be toggled with the "Visible" property, instead they use "Enabled". However, frames inside of GUIs and all other children of a GUI can be toggled with the "Visible" property. If you want a GUI to go away I don't think it would make sense to re-parent it, I think it would make more sense to either disable the GUI, make the main frame not visible or destroy the entire GUI. Here are some examples of how to do that:
local GUI = script.Parent
GUI.Enabled = false
OR
GUI:Destroy()
OR
local Frame = GUI:WaitForChild("Frame")
Frame.Visible = false
When I'm deciding whether or not to destroy or disable a GUI I often ask myself whether or not the GUI is going to be needed in the future or not. If the GUI is something that is opened up just once at a certain part of the game (such as if you click a brick in the game and it shows you a GUI allowing you to spawn something), then I will usually destroy the GUI after the player is done using it. However, if it's something which the player will be using more than once, I would simply disable the GUI or set the main frame's visibility to false. One thing to know is if you set a Frame's visibility to false then all of the children of that frame (text buttons, text, etc) will also become invisible.
I hope this is helpful. Let me know if you have any questions.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Do you mean a GUI? you can just turn off the "visible" option on the GUI properties.