List with all players in the game

I’ve been trying to make a list that shows all players in the game, however, it doesn’t show anything, and the output has no errors.

local main = script.Parent.Parent.Main
local pl = main.playersList
local template = pl['p-template']

local function refresh()
	for _,v in pairs(game.Players:GetPlayers()) do
		if pl:FindFirstChild(v.Name) then
		else
			local newPlayer = template:Clone()
			newPlayer.Name = v.Name
			newPlayer.player.Value = v
			newPlayer.username.Text = v.Name
			newPlayer.Visible = true
		end
	end
end

while true do
	wait(4)
	refresh()
	print("test")
end

For more information, pl is a scrolling frame, “test” is printed. I’ve tried to find solutions on the DevForum, but I got even more confused.

Resuming, it does not show my name on the list.

I don’t see you setting the parent of the TextLabel. Are you setting the parent to the frame?

2 Likes

Apparently, that was the error - I didn’t think it would be that simple, thank you.

1 Like