So making a short-term project. I got a lot of it don't and came across a roadblock im facing. How do I sort the players who have the most score to the least? Because if I sort the numbers I can't figure out the person who has the highest amount. This might be something simple, but I'm just too stupid to realize. Don't make fun of me :(
COMMUNITY QUESTION
How would I make a leaderboard in context of this picture?
1 answer
Store all of the players scores into a table and rearrange them using table.sort()
local Scores = {}
function setScores()
for i, v in pairs(game.Players:GetPlayers()) do
if v.Score then
table.insert(Scores, v.Score)
end
end
table.sort(Scores, function(a,b) return a > b end)
end
1 comment
0
Ok thanks
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks for the link how did u post that