I am trying to index a ScreenGUI, but I want to wait for the player's PlayerGui and The ScreenGUI to load in, so I've set it as a variable. Here is my code:

local Player = game.Players.LocalPlayer
local GUI = Player:WaitForChild("PlayerGui", 1):WaitForChild("SpecificScreenGUI", 2)

Here is my error:

Players.Zyrun.PlayerScripts.LocalScript:31: attempt to index local 'SpecificScreenGUI' (a nil value)

Here is the Hierarchy of the GUIs:

game/Players/Zyrun/PlayerGui/SpecificScreenGUI

Any help or insight would be great, thanks in advance!

3 comments

0

show the hierarchy of the gui

0

Edit made

0

I have tried this. I know the second argument(this is optional) is the timeout (delay before checking the object) My insight in this is manually adding the wait() method in there