Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

Thanks for the link how did u post that

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.