How can I add player's to a list?

I did something similar to this whilst making a custom leaderboard yesterday.
image
What i did was I inserted a local script into a scrollingframe with the uilistlayout within. Then, inside the localscript I inserted the “Sample” which is the Instance that will be cloned (aka the template). This may not be an effective method, but it works for me.

Then in the code you could try:

local list = script.Parent -- Scrolling frame

game.Players.ChildRemoved:Connect(function(player) -- if plr leaves the game, it removes from list
	if list:FindFirstChild(player.Name) then
		list[player.Name]:Destroy()
	end
end)


while task.wait(.05) do
	for _, player in pairs(game.Players:GetPlayers()) do
		
		if not list:FindFirstChild(player.Name) then
			local cloning = script.Sample:Clone()
			cloning.Name = player.Name
			cloning.PlrName.Text = player.Name
			cloning.Visible = true
			cloning.Parent = list
else
			local plr = list[player.Name]
				plr.Money.Text = player.leaderstats.Money.Value
		end
		
	end
end
2 Likes

It works! I made a few adjustments to your code:

(code was here)

Is “IsWanted” a child of the player? Is it a bool value? If so, ensure you do player.IsWanted.Value ==[...]

1 Like

Ah, I forgot the .Value. :sweat_smile:

1 Like