I correctly have a script that when you click the X button on the GUI it closes the GUI, no problem there. I go to open the GUI again... It doesn't appear. Does anyone know the problem..?
script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Parent.NAME.Visible = not script.Parent.Parent.Parent.NAME.Visible end)
Don't use Instance:Destroy() in this case, instead use Instance.Visible or Enabled if the Instance is a ScreenGui
.
Example:
local UI = script.Parent.Parent script.Parent.MouseButton1Click:Connect(function() UI.Visible = false end)
If you're trying to make it so you can use the same button to open/close it, use a debounce
Example:
local UI = script.Parent.Parent local debounce = false script.Parent.MouseButton1Click:Connect(function() if debounce then UI.Visible = true debounce = false else UI.Visible = false debounce = true end end)
I cannot guarantee these exact scripts will work for you because you did not provide any code or any tree of your Gui. For further notice, please show your current code and what you're working with or it seems more like a request.