So here is my code I used: script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible
end)
StarterGUI>ScreenGUI>Frame and I put the open and close gui in that screenGUI too. I put that code in the local script of the frame that I named OpenAndClose.

1 comment
Theres not even need for an if statement if its just switching a boolean.
Value = not Valuedoes the same.