Error defining a GUI from a different GUI


I’ve been working on a new intro UI recently and i want that, whenever a player joins, they can see only the intro UI.
For this reason there are two GUI’s named IntroGUI and NewMenu.

I tried to define NewMenu from a local script inside IntroGui so i can make it not enabled but i get the error “NewMenu is not a valid member of PlayerGui”. I don’t know how to fix it.

Placement : image

Script (only the error part) :

local NewMenu = script.Parent.Parent.NewMenu

   NewMenu.Enabled = false

Note : I took from the original script only the important parts that are needed in this topic.

Thank you for helping!


Try use Visible on all of the frames instead of using the whole UI.Enabled.

Here’s script

game.Players.PlayerAdded:Connect(function(player) --Runs when player joins
player.CharacterAdded:Connect(function(character) --Runs when player respawn
  player.PlayerGui:WaitForChild("NewMenu").Enabled = false -- You need to get player gui instead of starter gui

Just use WaitForChild:

local NewMenu = script.Parent.Parent:WaitForChild("NewMenu")

This should fix the issue.

1 Like