I'm making a Damage meter Gui, In order to make it, I need to know how to get the top 4 best damage dealers first then sort them in order so it's top 1, top 2, top 3, top 4, and the gui should update every 1 second or more.
Now, this is my epic failed attempt:
while wait(2) do for i,v in ipairs(Game:GetService("Players"):GetPlayers()) do local Dps=v:WaitForChild("TotalDamage") local DpsGui=v:WaitForChild("HealthGui"):WaitForChild("DamageFrame") print(math.max(Dps.Value,i)) end end
Could anyone explain me how to get the top 4 best damagers after getting each player's Stored NumberValue?
I'm not sure if there's any easier way to do it but you could use math.max(value1,value2, etc)
and then just remove the value from the tables so that way the next highest value would actually be the second highest.