I have created the following objectives:

  • health - health
  • health1 - dummy (used for health*100)
  • healthPerc - dumny (used for health1/20)

The only problem I'm having is that when I do: /scoreboard players operation @p health1 *= 100 health, it says Set [health1] for Username to 0 (having 20/20 hearts)

How do I do this?

2 Answers 2


It's a but unfortunate, but Minecraft actually sees "100" as a valid username. Where you wrote it, you need a name, which can also be a dummy player. You need to assign that dummy player or entity the value 100 in some scoreboard and then you can use that for operations.

  • I found a way to do it. I'll put it here when i get home.
    – Slendi
    Commented Nov 7, 2019 at 12:31
  • Something different than what I said? My solution is just two commands, I don't think you can do it in an easier way. Commented Nov 7, 2019 at 18:34
  • I posted my way of doing it as an answer. It isn't pretty, but it works
    – Slendi
    Commented Nov 10, 2019 at 19:37
R: /scoreboard players set @a temp 100
C: /scoreboard players operation @a health1 = @a health
C: /scoreboard players operation @p health1 *= @p temp
C: /scoreboard players set @a temp 20
C: /scoreboard players operation @p health1 /= @p temp
C: /scoreboard objectives setdisplay list health1


R=Repeating Command Block C=Chain Command Block

This is the way I did it. To have a percentage of the health, I needed to calculate it since if the player has more than 20 hearts, then the output will be 100+%

  • This is a bit confusingly written and too complicated. For example you set "temp" to 100 for every player instead of just one dummy player. It also doesn't work with multiple players, because two of your commands only use "@p". And the maximum health can also be different than 20, with effects. Commented Nov 10, 2019 at 20:50
  • @FabianRöling My goal isn't to make it multiplayer friendly since it is supposed to be played in singleplayer and i want it to show 150% or 200% so I don't see the problem but thanks for lettim=ng me know anyways
    – Slendi
    Commented Nov 24, 2019 at 15:02

You must log in to answer this question.

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