I am making a boss fight that uses a blaze mob. When i run the command it creates a bossbar, but it does not update the bossbar with the health of the mob and does not make the bossbar invisible when the mob dies.
[doublepost=1673536473,1673522982][/doublepost]Solved my problem, i was using local variables
Code:
command /blazetest:
trigger:
spawn blaze at location 1000.500, 160, 1000.500
set last spawned blaze's max health to 100
set last spawned blaze's health to 100
set display name of last spawned blaze to "§7[Lvl 200] §c§lPyroclastic Blaze"
set {_blaze} to last spawned blaze
set {_blazeBar} to bossbar named "blazeBossbar" with title "§c§lPyroclastic Blaze" with color bar red with style segmented 6
loop all players:
if distance between player and {_blaze} is less than 50:
add player to bossbar players of {_blazeBar}
on damage:
if victim is a {_blaze}:
set bossbar progress of {_blazeBar} to health of victim
on death:
if victim is {_blaze}:
set bossbar visibility of {_blazeBar} to false