How to track someone's Y position and make it stop at the highest result and display that result as a number on a scoreboard in minecraft? 1.19



  • I have /execute store result score run data get entity Pos[1] but I don't know how to execute and display the highest score once they player hits the highest possible score. idk if its possible to only track once it gets the highest position but I would love some help because I'm stuck rn



  • You could have a scoreboard with the Y value using your execute store (scoreboards are more versatile than data) and have another one with the highest score, using the operation > on scoreboard players operation subcommand

    /execute as @a store result score @s Y run data get entity @s Pos[1]
    /execute as @a run scoreboard players operation @s Ymax > @s Y
    

    And to display the score, you can use the simple setdisplay:

    /scoreboard objectives setdisplay sidebard Ymax
    

    Side note: The starting value for Ymax will be empty, but because of the operation, it will end up with 0 if your Y value is bellow 0 (for some odd reason) rather than whatever negavite value of Y you have.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2