How can I make a menu open and close button

Exactly, the both lead to the same object, the menu. But when printed out the variable version leads to “PlayerGui”.

Could you send a part of your gui and script so i can check?

Alright, could you try this instead?

local menu = script.Parent.Parent.Parent.Parent:WaitForChild("Menu")

I’m thinking this GUI loads in before the Menu.

It doesn’t error in that case, but it does print the children of PlayerGUI, and the children of PlayerGUI is “frame”.

edit: To clarify, it means the frame under Menu GUI, not the frame in menu open button GUI.

So, it is finally the menu, so it should work fine. The first print was printing the parent of menu, the second printing menu itself, and the third printing the children of menu.

1 Like

The script works now, thank you!

Last thing, why did it refer to the menu as PlayerGui?

I’m actually not sure. I think since there was no child named “Menu” it tried to search for a property of the PlayerGui named “Menu” and errored because “Menu” was not a property of the PlayerGui.

1 Like