execute if entity @s[tag=!healthTracked] at @s run summon text_display ~ ~ ~ {alignment:"center",text:'{"text":"||||||||||||||||","color":"green"}',billboard:center,transformation:{translation:[0f,0.6f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.0f,1.0f,0f]},Tags:["healthBar","newHealthBar","bossHealthBar"]}
ride @n[tag=healthBar,tag=newHealthBar] mount @s

execute if entity @s[tag=!healthTracked] at @s run summon text_display ~ ~ ~ {alignment:"center",text:'{"text":"Enemy"}',billboard:center,transformation:{translation:[0f,0.8f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.5f,0.5f,0f]},Tags:["nameBar","newHealthBar","bossHealthBar"]}
ride @n[tag=nameBar,tag=newHealthBar] mount @s

execute on passengers if entity @s[tag=healthBar,tag=newHealthBar] store result score @s maxhp on vehicle run scoreboard players get @s health

data modify entity @n[tag=nameBar,tag=newHealthBar] text set from entity @s CustomName

execute on passengers if entity @s[tag=healthBar,tag=newHealthBar] run tag @s remove newHealthBar
execute on passengers if entity @s[tag=nameBar,tag=newHealthBar] run tag @s remove newHealthBar
tag @s add healthTracked