How do I make a system that gets the highest points from a group of players?

how do I make a system that gets the highest points from a group of players? for example if a player caught the most fish in a round or if a player got the most KOs in a FFA fight, how would I count and display that? I would like to have it displayed in a list of most to least and be able to get which three people got the most. please help

Maybe these would help -

You could also use table.sort [which lets you return - send back 2 values, and adjust those values to what you need] see the example @Kaid3n22 has provided

1 Like

I would use table.sort in this case.

local fish = game.Players:GetPlayers()

table.sort(fish, function(a,b)
    if a.leaderstats.Fish.Value > b.leaderstats.Fish.Value then
        return true
    end
end)

print(fish[1].Name .. " has caught the most fish")
4 Likes