Engine Only Returns Responses for False

var dead:boolean=false;
function Update (){
if(Health.health==0){
dead=true;
}
}
if(dead==true){
print(“You are dead”); //never works
}
if(dead==false){
print(“You are not dead”); //consistently works
}

The game will return the “You are not dead” message when the variable is false, but will not return “You are dead” when the variable is true. Why is the script only working for the value false? If I reverse the two and for example make a variable “alive” that is true when health is not 0, it still does not return anything upon death. Any help? I can elaborate if there’s any necessary information I’ve left out.

I’m surprised that this code even compiled. Every code statement has to be inside a function (or method in C#).

As for your problem, the condition tests should be inside the Update function so that they may be evaluated at each frame:

var dead:boolean=false;
function Update (){
    if(Health.health==0){
    dead=true;
    }
    if(dead==true){
        print("You are dead");
    }
    if(dead==false){
        print("You are not dead");
    }
}

But this will print a message each frame. So you may need to add some logic to prevent that.

try putting the two if statements under the funtion Update()