help with boss death (bool)

Hi all, this is driving me mad, can anyone help?

What i’m trying to do is have my boss die and make an explosion, where am I going wrong?

currently, once the boss’s health reaches 0, he just carries on, no death, no explosion.

this is my script :

var death : Transform;
var delay : int = 0;
var bossdead : boolean = false;

function Start(){

bossdead = false;

}


function Update(){

if(boss_healthbar.LIVES <= 0){
bossdead = true;

}
}

if(bossdead) {

Instantiate(death, transform.position, transform.rotation);
var boss = GameObject.FindWithTag("boss");
Destroy(boss);

yield WaitForSeconds(delay);

Application.LoadLevel(69);

}

Did you populate the “death” variable?
Also, did you apply the “boss” tag to the boss object?

Also you should delete yield WaitForSeconds(delay); as it has no effect (you need to read up more on coroutines).

Also:

It looks like you have an extra bracket here:

   function Update(){
     
    if(boss_healthbar.LIVES <= 0){
    bossdead = true;
     
    }
    }

Remove one of those last brackets, you are essentially closing out the Update() method and the rest of the code is getting run. You should be getting some compiler errors actually since the rest of the code isn’t in a method.