Various endings.

I need to make a various endings.
First one: “character” activates a trigger while “bouncingBall” is alive, so it goes to good ending.
Second: “character” activates a trigger while “bouncingBall” is destroyed, so it goes to bad ending.
Here is my script for the trigger object, but it don’t work properly.

var bouncingBall : GameObject;
var character : GameObject;

function OnTriggerEnter (other : Collider){
 	if (other.gameObject.tag=="Character"){	 
		if (bouncingBall == null)
		Application.LoadLevel ("Congrats_Bad");
		}
		
 	else{
		Application.LoadLevel ("Congrats_Good");
		}
}

What I should do to make this work? Somehow edit a code, or logic itself?
Sorry for my bad English.

Try this:

var bouncingBall : GameObject;
var character : GameObject;
 
function OnTriggerEnter (other : Collider) {
	if (other.gameObject.tag=="Character") {    
		if (bouncingBall == null) {
			Application.LoadLevel ("Congrats_Bad");
		}
		else{
			Application.LoadLevel ("Congrats_Good");
		}
	}
}

Your indentation is right to your logic. If you look your “Congrats_Good” is only executed if other.gameObject.tag != “Character”.