I am currently making a minigame to play right now, (specifically a racing game) but I am unsure how to find the personal best of a player at the end of the game. I have a timer setup, but my objectives seem to make this task a little difficult? I know the scores of the times will play into this, so I will explain what I have setup with the times.

1.) I have objectives, dispsecond and dispminute. These stand for Display Second and Display Minute. Simply, it functions as a normal timer. At the end of race, everyones' timers halt. So at the end of the race, one's score may be: 1-dispminute 39-dispsecond

Now my question still stands, how do I find the personal best?

  • Are you doing this with redstone or command blocks? If you're using any number of command blocks (which it looks like) you shouldn't have any redstone, and therefore shouldn't tag your question as such.
    – MBraedley
    May 31, 2016 at 19:10
  • Sorry I just changed my question. Could you read that? (With command blocks)
    – Jdoe
    May 31, 2016 at 19:15
  • Save the time and update their best time whenever you encounter a faster time.
    – GiantTree
    May 31, 2016 at 20:39
  • +GiantTree but how?
    – Jdoe
    May 31, 2016 at 20:41

2 Answers 2


Use scoreboard operations

I assume you also have the time stored in a non-formatted scoreboard, e.g. in ticks. Let's call that objective time. If not, see below.

Make another dummy scoreboard objective called best, and initalize it to 0, e.g. by running

/scoreboard players add @a best 0

When a player finishes the race, mark him in some way, e.g. by assigning a tag (I'll use tag=finished). Then simply run

/execute @a[tag=finished] ~ ~ ~ scoreboard players operation @a[c=1] best < @a[c=1] time

The < operator will assign the lesser score of best and time to best. The execute makes sure that both targets of the scoreboard command are the same player.

You can turn best into bestminute and bestsecond the same way you converted time into the display stats.

Converting times to a single number

If you don't have time stored as a single continuously increasing number, you can use scoreboard players operation commands to turn your dispminute and dispseconds scores into one. Set up the new objective, and store the number 60 in a fake player (called #SIXTY):

/scoreboard objectives add time dummy
/scoreboard players set #SIXTY time 60

Now, set up a repeat/chain line and run.

/scoreboard players set @a time 0
/execute @a ~ ~ ~  /scoreboard players operation @a[c=1] time += @a[c=1] dispminutes
/execute @a ~ ~ ~  /scoreboard players operation @a[c=1] time *= #SIXTY time
/execute @a ~ ~ ~  /scoreboard players operation @a[c=1] time += @a[c=1] dispsecond

This will first reset the time score for every player. Then, the players' scores in dispminutes will be added to time, and multiplied by 60. Lastly, dispseconds is added to time.

  • Ok, I just did a little tweaking, and it all works flawlessly. But, just one more thing MrLemon. You said 'You can turn best into bestminute and bestsecond the same way you converted time into the display stats.' I'm not so sure how to do that. Can you explain?
    – Jdoe
    Jun 1, 2016 at 18:04

Check for the largest dispminute and then the ones that are the same dispminute check for the largest dispsecond. If you would like I could make my own version for example... But since I'm more of a redstone I would use items to count... That just me though.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .