losing lives

I have made a code of when you enter the trigger of the enemy, you lose a heart. you have 3 hearts. when i get hit by the enemy, all my hearts go? WHY?

#pragma strict

var Lives : int = 3;
var LivesToDie : int = 0;

var Heart1 : GUITexture;

var Heart2 : GUITexture;

var Heart3 : GUITexture;

var DieScene : String;

function OnTriggerEnter(other: Collider){ 
                Lives -= 1;
				if(Lives >= 2){
				Heart1.enabled = false;
}	
				if(Lives >= 1){
				Heart2.enabled = false;
}
				if(Lives >= 0){
				Heart3.enabled = false;
				yield WaitForSeconds(0.5);
				Application.LoadLevel(DieScene);
	}
}

PS: if its a really stupid error i’m only ten so thats probably why :confused:

More power to you coding at 10. ‘Lives’ is correctly decremented. The issue is with your ‘heart’ and loading logic. I’m not sure which way you are counting your hearts, but try this instead:

function OnTriggerEnter(other: Collider) { 
    Lives -= 1;
      
    Heart1.enabled = (Lives >= 1);
    Heart2.enabled = (Lives >= 2);
    Heart3.enabled = (Lives >= 3);

    if (Lives <= 0) {
          Application.LoadLevel(DieScene);
     }
}