execute if score @s health matches 101.. run scoreboard players set @s health 100
execute if score @s health matches ..-1 run scoreboard players set @s health 0
execute if score @s health matches 51..100 run return run data merge entity @n[tag=health] {interpolation_duration:0,text:[{"translate":"health","with":[{"score":{"name":"@a[tag=playing,limit=1]","objective":"health"},"color":"green"}]}]}
execute if score @s health matches 26..50 run return run data merge entity @n[tag=health] {interpolation_duration:0,text:[{"translate":"health","with":[{"score":{"name":"@a[tag=playing,limit=1]","objective":"health"},"color":"yellow"}]}]}
execute if score @s health matches ..25 run return run data merge entity @n[tag=health] {interpolation_duration:0,text:[{"translate":"health","with":[{"score":{"name":"@a[tag=playing,limit=1]","objective":"health"},"color":"red"}]}]}