HELLOOOO
Soo...I'm trying to make a leaderboard that shows the highest time someone has spent alive and who is #1 on the leaderboard. I have everything set out, but the problem is that instead of it showing all the players, it only shows 1 player. And they aren't even 1st place; they're 2nd. Help? I have it so that when a player leaves, I take their rank off the board.
Here is my script:
game.Players.PlayerRemoving:Connect(function(player)
local labels = script.Parent:GetChildren()
for _,label in pairs(labels) do
if label:IsA("Frame") then
if label.PlayerName.Text == player.Name then
label:Remove()
end
end
end
end)
wait(3)
while true do
local list = game.Players:GetPlayers()
table.sort(list, function(player1, player2)
return player1.HighestTime.Value > player2.HighestTime.Value
end)
for i = 1,#list do
local rank = "#"..i
local Time = list[i].HighestTime.Value
local name = list[i].Name
local labels = script.Parent:GetChildren()
for _,label in pairs(labels) do
if label:IsA("Frame") then
label:Destroy()
end
end
local template = script.Template:Clone()
template.Parent = script.Parent
template.Name = i
template.Rank.Text = rank
template.Time.Text = Time
template.PlayerName.Text = name
end
wait(5)
end
It's a normal script located in a part that's in workspace.

2 comments
Does the frame have UIListLayout inside of it? I ask because it could be because if there are 2 players, first gets added and without ListLayout the second gets added above the first, it's just a theory tho. Do you see all the frames inside of explorer?
I do have a UIListLayout. But when I look inside the SurfaceGui, it only has one frame.