Minecraft – Change players health based on scoreboard objectives

minecraft-commandsminecraft-java-edition

I have a custom map in which I have a scoreboard objective. Is there any way to change a player's health based on this scoreboard objective? The only thing I could find was putting a button on a player's head with the max health attribute but that has many disadvantages.

Best Answer

1st: /scoreboard objectives add [name] health [display name]

Add any name to name and display name

2nd: /scoreboard objectives setdisplay belowname [name]

Set the name you want to display at the scoreboard at name

(Your health will show up as 0 until you lose some...it's a bug)