I’m making a custom playerlist, and I’m getting an error on the client whenever someone leaves:
But the confusing part is this other player has nothing to do with what’s being referenced. It should only
concern the player referenced in the frame. I even added a check to make sure the “phantom player” wasn’t nil when they leave but it didn’t help.
Also, the code works completely fine upon a player joining and just while playing. Bizarrely, the error doesn’t even break the loop even though I didn’t make it a pcall or anything.
Here’s the code (note I’ve cut out all irrelevant portions):
local playerName = script.Parent.Name -- this is a textlabel where the name is the same as the player being referenced
local displayName = script.Parent.displayName --textlabel
while true do
if script.Parent.Parent.Visible == true then
if game.Players:FindFirstChild(playerName) then --error occurs here
displayName.Text = " "..game.Players:FindFirstChild(playerName).DisplayName
--more various information goes here (reason for it being in a loop)
end
end
task.wait()
end