Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make a leaderboard in context of this picture?

Asked by 5 years ago
Edited 5 years ago

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 :(

https://gyazo.com/eedb090bf0c705048a82820a0676bb54

0
Thanks for the link how did u post that DjMusa2 81 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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
0
Ok thanks NumbersInBinary 33 — 5y
Ad

Answer this question