I’ve run into an issue where I’m trying to get something from the PlayerGui, but for some reason – even though in the hierarchy it shows it is there – :WaitForChild("bla")
is infinitely yielding.
Data dump:
Warning:
Infinite yield possible on 'BuildTool:WaitForChild("InformationPanel")'
Hierarchy:
Code:
--[[ ROBLOX SERVICES ]]
local PLAYERS = game:GetService("Players")
--[[ GLOBALS ]]
-- These all work fine
local ConfigDisplay = script:WaitForChild("ConfigDisplay")
local Spacer = script:WaitForChild("Spacer")
local InfoDisplay = script:WaitForChild("InfoDisplay")
local Layout = script:WaitForChild("Layout")
local InfoDisplayLayout = script:WaitForChild("InfoDisplayLayout")
local LocalPlayer = PLAYERS.LocalPlayer
-- this where we at
-- Adding wait(1) here fixes this, for whatever reason.
local GUI = LocalPlayer.PlayerGui:WaitForChild("BuildTool")
:WaitForChild("InformationPanel") -- This waitforchild, specifically
:WaitForChild("MainArea")
Thoughts/Observations
As you can see, InformationPanel
definitely exists as a descendant of PlayerGui.BuildTool
, but for some reason when I attempt to grab it with WaitForChild
it yields infinitely.
If I call wait(1)
before this line, it works, but I don’t know if it will work in all cases. Besides, WaitForChild
is implied it will wait anyways, why do I have to call wait(1)
for WaitForChild
to work?
I believe there’s an engine bug here, but I can’t post to engine bugs yet.
Edit for clarification:
It’s not just displaying the warning then loading, it’s outright failing to “wait for” InformationPanel
unless I add wait(1)
.