Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 2 years ago

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")
0
Update: Same error occurs when testing it in the actual game User#20989 0 — 2y
0
Local script or server script? Thepoint13 99 — 2y
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. User#22722 20 — 2y
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 User#20989 0 — 2y

1 answer

Log in to vote
1
Answered by 2 years ago

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.

0
Appreciate it! I re-wrote the code a bit and put it inside a Local Script. User#20989 0 — 2y
Ad

Answer this question