What's a good way to make a health bar using the bossbar command (For multiplayer pursposes)
It is not the result I hoped to come to, but I have eventually just started using the "lots of different bossbars" method. Since I use datapacks this isn't a huge issue anymore in terms of lag. I still need to create hundreds of commands at times, but I made a pythonscript that does it for me and creates a text file with all commands in it. So it only takes a few minutes at max instead of hours. I created a revival system for a hardcore-like multiplayer yesterday and I used 300 bossbars for it (5 minutes revive time, 1 bossbar per second). It runs without problems or lag and was generated using the script.
Script: (this is exactly what I used for mine, I didn't have time to generalise it first)
bossbar = 1001
value = 1
revivemin = 1
revivemax = 20
x = 1
time = 300
fullstring = ""
while (x <= 300):
strbossbar = str(bossbar)
strtime = str(time)
strmin = str(revivemin)
strmax = str(revivemax)
strvalue = str(value)
fullstring = fullstring+('bossbar add '+strbossbar+' {"text":"Revive ('+strtime+'s)","color":"green"}\nbossbar set '+strbossbar+' color green\nbossbar set '+strbossbar+' max 300\nbossbar set '+strbossbar+' players @a[scores={death=1..,revive='+strmin+'..'+strmax+'}]\nbossbar set '+strbossbar+' style progress\nbossbar set '+strbossbar+' value '+strvalue+'\nbossbar set '+strbossbar+' visible true\n\n')
x += 1
bossbar += 1
value += 1
revivemin += 20
revivemax += 20
time -= 1
f = open("output.txt", "x")
f.write(fullstring)
f.close()
Edit: This version has another good side to it compared to the value method as you can give every different bar each own name making it quicker to see your exact health/mana/...