Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

So I am trying to make a open/close gui system but the button wont open it. Any help?

Here is the code that doesn't work:

script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Visible = true end)

And for some reason i get this error message:

23:40:45.655 - Visible is not a valid member of ScreenGui

Also i tested it and the close button does work for some reason but the open button does not here is the close code that does work:

script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Visible = false end)

1 comment

1

try .Enabled

2 answers

✓ Accepted answer

ScreenGui doesn't have a property called Visible. These are only for other GuiObjects such as TextButton, ImageLabel, etc.

If you are sure you want the ScreenGui to be invisible, use this script.

script.Parent.MouseButton1Click:Connect(function() 
	script.Parent.Parent.Enabled = true 
end)

It's not much different except that I changed Visible to Enabled.

Enabled is the property of the ScreenGui you are looking for.

Don't forget to accept this answer if I helped!

What makes you think that ScreenGui's have a property called Visible, they don't! Also for a GUI to appear, you don't set the screen GUI to visible, you set its descendants to visible! If you want a GUI to appear, the script is down below for you.

script.Parent.MouseButton1Click:Connect(function()
  script.Parent.Parent.Visible = true -- Assuming that you want a GUI to appear, not the ScreenGui it self
end)

Or if you want to the UI to close and open upon clicking, the script would be:

script.Parent.MouseButton1Click:Connect(function()
  script.Parent.Parent.Visible = not script.Parent.Parent.Visible -- Assuming that you want a GUI to appear, not the ScreenGui it self.
end)

Or just in case, you want the ScreenGui itself to disappear.

script.Parent.MouseButton1Click:Connect(function()
  script.Parent.Parent.Enabled = not script.Parent.Parent.Enabled -- Assuming that you want the ScreenGui to be disabled..
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.