for i,v in pairs(game.Players:GetPlayers()) do t1 = {} KO = v.leaderstats.KOs.Value table.insert(t1,#t1+1,KO) end table.sort(t1) print(t1[#t1])
is part of
local GameModes = {} function FreeForAll() for i,v in pairs(game.Players:GetPlayers()) do Firefox = {} zenox = v.leaderstats.Value table.insert(Firefox,zenox, #Firefox + 1) table.sort(Firefox) print(Firefox[#Firefox]) end end function MultiTeam() end function Choosemode(Mapchosen) if Mapchosen == "Sol2" then FreeForAll() print("Sol2") end if Mapchosen == "ArenavonOsterreich" then MultiTeam() print("ArenavonOsterreich") end end return GameModes
So I'm trying to get the player with the highest KO value right?
Problem is, It's not working,
The highest value of KOs is 5, yet it prints "0" instead No errors in the output.
Help me out here. Thanks in advance
Here's my way to get the highest KO's...
local KOs = "KOs" -- Insert the name of your KOs value local highestKOs = 0 local Player for index,returned in ipairs(game.Players:GetChildren()) do if returned:FindFirstChild("leaderstats") and returned.leaderstats:FindFirstChild(KOs) then if returned.leaderstats[KOs].Value > highestKOs then Player = returned.Name highestKOs = returned.leaderstats[KOs].Value end end end print("Player: "..Player.." // KOs: "..highestKOs)
This will get the player with the highest KOs.