Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

WaitForChild throwing errors when the child I'm looking for is obviously there?

Asked by
zyrun 168
6 years ago
Edited 6 years ago

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!

0
show the hierarchy of the gui Rare_tendo 3000 — 6y
0
Edit made zyrun 168 — 6y
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 saSlol2436 716 — 6y

Answer this question