Hello, everyone.
I’m currently working on a free for all gamemode for my arena shooter. However, I’m not sure how exactly to detect what place a player is in, based on score. There’s a value called “Kills” under a folder called “GamemodeData” which is then under the player object.
Any help would be greatly appreciated!! 
1 Like
Do you mean leaderboard standings?
Yeah, that’s what I’m going for.
Store the Data in a Table and use table.sort()
Alright.
I’ll see how that turns out.
This is something I made a while back.
Two functions.
sort takes in a table of Players with their level, so
players = { {Player,level} , {Player2,player2level} }
function sort(tbl)
table.sort(tbl,
function(a,b)
if a and b then
if a[2] and b[2] then
local player1level = a[2]
local player2level = b[2]
return player1level > player2level
else
return false
end
else
return false
end
end)
end
function setLevels()
local Players = {}
for i,Player in pairs (game.Players:GetPlayers()) do
local Level = Player.Level.Value
table.insert(Players,{Player,Level})
end
sort(Players)
--Here is where you do your code. Now you have a table with players in order of highest level to lowest.
end
1 Like
Alright.
And for external handling, such as displaying a Victory or Defeat screen at the end, I could simply put whoever is in first place in a value that any player can access?
I was editing and sent by mistake woops.
But yeah you can do that. Multiple ways to do it.
1 Like
Alright, sweet! 
I shall see how this goes!
1 Like