I want to use the bossbar command to create a health bar for the players (each seeing ONLY their own health). So I came to the conclusion that there are two main ways to do so:
This is the best but is single player only:
- Create scoreboard called "health" linked to the player's health
- Create bossbar called "health"
- Run command
/execute as @a store result bossbar minecraft:health value run scoreboard players get @s health
This way the bossbar will always be equal in value to your health, but as mentioned, it doesn't work on more than one player. However, it uses only 1 command block.
This one is a pain to do but runs on multiplayer:
- Create scoreboard called "health" linked to the player's health
- Create bossbars equal to the amount of health you need it for (in this case the standard 20 HP)
- Give each bossbar a respective value from 1-20
- Use the command
/execute as @a[scores={health=x}] run bossbar set healthx players @s
(x being the amoun of health the bossbar is linked to.)
It's a complete pain as it needs lots of bossbars and 1 command block per health value.
So I wonder, is it possible to have a simple solution (like n°1) that works on multiplayer (like n°2)?
0.5..0.99999
. Other than that, good idea, I don't know anything better.