variable <= 1 not working. HELP

#pragma strict

var Player : GameObject ;
var spawnPoint : Transform;
var health : float = 25;
var colors = new Color[2];
var velBack:float = 15;
var dir:Vector3;
var dead : boolean;

	function Update () { 
	if(health <= 1){
		dead = true;
			yield WaitForSeconds(.5);
			var P : GameObject = Instantiate(Player, spawnPoint.position, Quaternion.identity);
			var sf = Camera.main.GetComponent(SmoothFollow2); = P.transform;

function OnTriggerEnter(other : Collider){
	if(other.GetComponent(Enemy).stomp == false && other.tag == "Enemy" || other.tag == "Damage"){
		health -= other.GetComponent(Damage).damage;
		dir = (transform.position - other.transform.position).normalized;
			var charMotor = GetComponent(CharacterMotor);
		renderer.material.color = colors[0];
		yield WaitForSeconds(.1);
		renderer.material.color = colors[1];
		yield WaitForSeconds(.05);
		renderer.material.color = colors[0];
		yield WaitForSeconds(.1);
		renderer.material.color = colors[1];

this is my player health script and in the unity editor the players health does go down when he is hit however when his health gets below 1 nothing happens, the “dead” variable stays false. I can’t figure out why! I tried changing values and variable names and even restarting unity. I know I must be missing something and I’m just not seeing it. Someone please help.

I’m not sure if destroying the game object and after that run code is a good idea.
Instead of destroying your game object, I think you should simply turn it off, and than, after your yield you destroy it.

Other than that, if that’s the player script, wouldn’t it make more sense, instead of destroying it, simply reset the variables?
I mean, instead of destroying the player and instantiating a new one, keep the player object, reset the health - and any other control variable you may be using - and set it’s position.

Destroy is something that is always good to be avoided.

I know I didn’t answered your question yet, but, being direct, your code seems to be correct, it’s hard to know why it wouldn’t change the flag’s value.

As our friend suggested, try debugging it. Sometimes the inspector checkbox won’t change, despite the fact that the variable value has changed.