How to make a 1st Place system?

How can I make a 1st place system like arsenal? Not only 1st place, but 2nd and 3rd place. I have a timer, and when the timer ends, I would like the server to look through all the players (no matter which team they are on), and check the top 3 players kills, & to check who wins 1st, 2nd, or 3rd place. Also, a frame that shows all the players who got in the top 3, and then reward the top 3 players. Let me know where I can learn and code the 1st place system.

Please could you provide much more information to work with. Use the template text as a guide to what you should state when creating a topic.

I changed it so people can understand it now.

Sweet. Where are your kill variables stored? In the player?

You would just add like a value to everyone which will contain for example whenever someone is killed and then just see who has the largest amount of kills for example.

Add an IntValue into the Player Each kill the Player gets it gives them += 1 In the IntValue

After the Game ends loop through the Players like this

``````for i, Player in pairs(game.Players:GetPlayers()) do
``````

Then check which is the Most Kills that the Player has (IntValue basically)
And display their name and Avator on the Gui

Making this system is pretty simple if you saved the kills on the player then you can just iterate the players check if playerKills >≠ currentTop3 then currentTop3 = playerKils then another if statement if currentTop3 > currentTop2 then currentTop2 = currentTop3 so on so fort.
On the other hand if you saved the kills on a table then you can just use table.sort according to the player kills. Actally you can just use thus option since Players:GetPlayers() returns a table.

``````local t = Players:GetPlayers()
table.sort(t, function(a, b)
return a.PlayerKills.Value > b --forgot what was b I think its still a player
end)
``````

Then you can just get the top3 with `top3 = t[#t-3]`.

I have a kills value in my leaderboard, but I’m probably gonna store another IntValue in the player, so that the IntValue is for just the round. The kills value is for how much kills the player has got total by playing my game.

How would I check the players values in that loop?

You can accomplish this by using Table Sorting or looping through manually.

First, you need to get a table of the players, which can be grabbed using :GetPlayers()

``````local Table = game:GetService("Players"):GetPlayers()
``````

This is how you can sort the table using Table Sorting.

``````local Table = game:GetService("Players"):GetPlayers()
table.sort(Table, function(one, two)
return one.Data.Kills.Value > two.Data.Kills.Value
end
``````

You can then get position #1, #2, # by grabbing them using Table[1], Table[2], Table[3].

Before I try this code, what does the Data Represent?