Hi, I'm working on a custom player list GUI, but I'm having trouble setting the text's in the labels to the players name. In total, it can hold 30 players, uses a scrollframe, and is suppose to update when a player joins/leaves the game. I'm using filteringenabled and although I was able to get it semi-working when the script was in the serverscriptservice when I move it to the actual GUI it doesn't work. I rewrote the script several times and no matter what I do, for some reason it doesn't work while in the GUI. Here's the script:
gui = script.Parent frame = gui.Frame labels = frame:GetChildren() players = game.Players:GetPlayers() function updatelist() for a = 1,30 do num = a for b,p in pairs(players) do if b == num then for c,l in pairs(labels) do if l.Name == ("Name "..num) then l.Text = p.Name end end end num2 = b end if num > num2 then for d,l in pairs(labels) do if l.Name == ("Name "..num) then l.Text = " " end end end end end game.Players.PlayerAdded:connect(updatelist) game.Players.PlayerRemoving:connect(updatelist)
Thanks for the help!