✓ Accepted answer
You can simply use a variable to check if the value of the player is greater than the value of the last player, so until it reaches the highvalue
Example:
local high = 0
for _,v in pairs(game.Players:GetPlayers()) do
if v.leaderstats.Money.Value > high then
high = v.leaderstats.Money.Value
end
end
print("High value is: " .. tostring(high))
For your script you can use this:
local high = 0
for _,v in pairs(workspace.Players:GetChildren()) do
local player = game.Players:FindFirstChild(v.Name)
if player then
local Kills = player.leaderstats.Kills
if Kills.Value > high then
high = Kills.Value
end
end
end
print("The high value is: " .. tostring(high))
Hope it helped :)
1 comment
I posted an answer, you can see the answer?