function update() c = script.Parent:GetChildren() for i = 1,#c do if string.sub(c[i].Name, 1, 11) == "PlayerLabel" then c[i].Visible = false end end for i = 1,#plr do item = script.Parent:findFirstChild("PlayerLabel" .. tostring(i)) if (item~=nil) then item.Visible = true item.Text = plr[i].Name end end end
function getNumber(obj) for i = 1,#plr do if plr[i]==obj then return i end end end
plr = {} p = game.Players:GetChildren()
for i = 1,#p do table.insert(plr, p[i]) end
update() game.Players.ChildAdded:connect(function (guy) table.insert(plr, guy) update() end) game.Players.ChildRemoved:connect(function (guy) table.remove(plr, getNumber(guy)) update() end)