Minecraft Commands – How to Find Top Scores of an Objective

minecraft-commandsminecraft-java-edition

I am trying to figure out how to find the top scores for a Kills objective. I have the Kills at the criteria playerKillCount, but that doesn't really matter.

I wanted it so I can effectively take the top 3 scores of the objective, and put them on signs, as you I can use selectors in signs along with blockdata.

I have tried my method, which is to remove all the scores until they reach 0, and see which player had a minimum of one, however it seems a little inefficient. Any way this can be done?

Best Answer

command

scoreboard players set highest scb -2147483648 execute (entities that needs to compare the score) ~ ~ ~ scoreboard players operation highest scb > @e[c=1] scb

Principle:

highest = INT_MIN for i in entities: if i.scb > highest: highest = i.scb