Make mopst kill podium after round

i want a podium with the 3 most kills players… how do i get the most kills players?
theres a value in each playermodel called “kills” how do i get the three most killed?

2 Likes
local Players = game:GetService("Players")
local KillsValue = "kills"

--Returns a list of {PlayerInstance, KillCount} in descending order of kill count
local function GetKillLeaders()
	local Killers = {}
	for i, Player in ipairs(Players:GetPlayers()) do
		if Player.Character then
			table.insert(Killers, {Player, Player.Character[KillsValue].Value})
		end
	end
	table.sort(Killers, function(KillerA, KillerB)
		return KillerA[2] > KillerB[2]
	end)
	return Killers
end

Something like this. If you only want the first three, replace return Killers with:

return {Killers[1], Killers[2], Killers[3]}
4 Likes

OK AND how do i make a script recieve these values and assign them to something?

1 Like

also why are you getting the characters?

1 Like

Those values are simply examples and are something you should keep track of by having it inside a character or player (preferably player). These are basic information for scripting in terms of leader stats. You should take a look at the foundations of coding before proceeding with this task if you are new to programming.

2 Likes

That’s what the script does though

1 Like

this might be helpful to be solved…

1 Like

How do you always have like 500 different questions.

2 Likes

That’s an entirely different question.

1 Like