Hi, I've been having a lot of trouble over the past days trying to figure this out but nothing is working. I've tried to look for understanding on what it means by infinite yield is possible, and I've tried so much, but nothing is working. Here is my script.
for i, player in pairs (game.Players:GetPlayers()) do
player.PlayerGui:WaitForChild('playerInterface')
end
function Intermission(TextValue)
for i, player in pairs (game.Players:GetPlayers()) do
if player:FindFirstChild("PlayerGui") and player:FindFirstChild("PlayerGui"):FindFirstChild("playerInterface") then
player.PlayerGui.playerInterface.intermission.Text = tostring(TextValue)
end
end
Whenever I dont put in the WaitForChild() the gui doesnt work, when I do put it in, an Infinite Yield comes up and the script itself entirely breaks. However, I found a solution, but then whenever I would be to reset my character, It would completely remove the GUI ( I used clone(). ) This is in a regular script.
Any help would be much appreciated, thank you for your time reading this.

5 comments
Try just using a "wait(1) at the top of the script or however long it takes for it to load
I'm not sure how it is if you have FilteringEnabled disabled, but at least when it's enabled the server doesn't have access to players' PlayerGuis (meaning that the WaitForChild will never return, triggering the warning you got)
@chess123mate, If that's the case, how will the game work in terms of the new update where it is a component to have filtering enabled if you want like i think its ages under 13 to play your game
@chess123mate, Nevermind, Thanks for your help it worked!
If your script ends up not working, check out the guides at the top of Scripting Helpers for RemoteEvents/Functions and server/client communication. Ideally the server would use RemoteEvents to broadcast to clients when intermissions start/end and what text to display.