How to record a high score in minecraft 1.12

So I'm trying to make command blocks record the highest score a player get's (using /scoreboard). I also did find an answer to the question but it's for minecraft 1.8 here's the link if that helps.


Solution 1:

So I think you want to have a highscore for each seperate player? Well I read that the scoreboard commands for 1.8 and 1.12 are the same so here it is for 1.8

First you make 2 scoreboard objectives.
/scoreboard objectives add Score dummy
/scoreboard objectives add Highscore dummy

You put these commands into a commandblock into a fast repeater clock.
/scoreboard players set @a[tag=!added] Score 0 /scoreboard players set @a[tag=!added] Highscore 0 /scoreboard players tag @a[tag=!added] add added
Now new players will automatically been added to the scoreboard with a score of 0. Players who already are on the scoreboard will keep their score.

Now you'll keep updating their scores only when their score is higher than their old score this will take a few commands: Put this in a redstone clock:
/scoreboard players operation @a[tag=added] Highscore -= @a[tag=added] Score /execute @a[tag=added,score_Highscore_min=-999999999,score_Highscore=-1] ~ ~ ~ scoreboard players tag @e[c=1] add Highscore So when their highscore - their score (10-11) = -1 means if the output is negative their score is higher than their highscore.

Now we'll update their highscore when score>highscore:
/scoreboard players operation @a[tag=Highscore] Highscore = @a[tag=Highscore] Score
/scoreboard players tag @a[tag=Highscore] remove Highscore

If you want to see the highscore execute this command to show:
/scoreboard objectives setdisplay sidebar Highscore
and this one to hide:
/scoreboard objectives setdisplay sidebar

This works fine for 1.12 so it should also for 1.8 cause there are no changes between those versions.

I hope this was usefull cause this needed a lot of time to write xD

EDIT: to reset someones's score type this: /scoreboard players tag <Name> remove Added