I am making a sandbox game in roblox where players can make their own obby. I have come across an EXTREMELY outrageous and frustrating glitch in my game that in the developer console, it says "ScreenGui is not a valid member of PlayerGui," even though i can still see all the other descendants of that same screengui on my screen. It works in studio but not in Roblox player. This is definitely the most frustrating and confusing glitch i've ever came across. When I use WaitForChild("ScreenGui") it says "Infinite Yield Possible" and never runs the script.
Edit:
Here's the scripts im using:
In a model (Regular Script):
part = script.Parent
function configure(player)
if player.Team.Name == part.Parent.Parent.Name then
player.PlayerGui.ScreenGui.EditObject.Object.Value = part
end
end
part.ClickDetector.MouseClick:connect(configure)
in a TextLabel in a Descendent of ScreenGUI (LocalScript):
while true do
function updateText()
if script.Parent.Parent.Object.Value then
script.Parent.Text = script.Parent.Parent.Object.Value.Name
end
end
wait()
updateText()
end

4 comments
I have already answered this, it means that ScreenGui doesn't exist. Check if you have duplicates of 2 screenGuis and also make sure you name them.
If :WaitForChild() says Infinite Yield it means it doesn't exist
ScreenGui does exist, and it has no duplicates.
it works in studio but not in Roblox Player.