Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Infinite yield possible on 'Players.Player1.PlayerGui:WaitForChild("playerlist")' ?

Hi guys. So I've tried to make a custom playerlist which allows users to see who's in their game without using the old-school ROBLOX leaderboard.

When testing it solo in studio, the GUI pops up perfectly and displays the username, yet whenever I try to test it inside a Local Server, the error "Infinite yield possible on 'Players.Player1.PlayerGui:WaitForChild("playerlist")'" pops up every time, which tells me it basically waits for the playerlist to show up, even thought it isn't there.

When I check the PlayerGui inside the Local Server Client, I do find the GUI, but when I check the PlayerGui inside the Local Server host, neither of the test players have anything inside their PlayerGui.

How can I fix this?

This is literally the only part that somehow stops my game from working: (I added two WaitForChild's in there to be sure)

game.Players.PlayerAdded:Connect(function(plr)
	local gui = plr:WaitForChild("PlayerGui"):WaitForChild("playerlist")

4 comments

0

Update: Same error occurs when testing it in the actual game

0

Local script or server script?

0

I don't think you spelt it right or its not in it. Try take a look in there when your playing in studio.

0

It's a server script, and I checked the spelling, it's correct. Even copied it from the original GUI. I am completely lost

1 answer

✓ Accepted answer

Do what you need to do in a LocalScript instead, or create the gui from the server. Right now the Gui only exists in the PlayerGui on the client. If you create the Gui from the server instead it should work, or if you just use a LocalScript it should work.

1 comment

0

Appreciate it! I re-wrote the code a bit and put it inside a Local Script.

This discussion is preserved as it was. New answers, comments, and votes are closed.