OnTriggerEnter to load new level

Hi, I’m making a game where the player collects fruit, and must collect a certain amount to proceed to the next level. I have a cube at the moment as the end of level, where i’m trying to make it as a trigger to go to the next level if the player has 3 points, and go to a game over/retry scene if the have under 3. I have set the cube collider as a trigger, and this is my code:

var Counter : int = 0;
var fruit : int = 3;

 
function Update () {
 guiText.text = "Score is: "+Counter;
 
} 
function OnTriggerEnter(col : Collider){
	if(col.gameObject.tag == "end")
	if (gameObject.name == "Player")
   	if (Counter == 3)
      	Application.LoadLevel("level2");
      	
   	else if(col.gameObject.tag == "end")
			if (gameObject.name == "Player")
			Application.LoadLevel("gameover");
}

Nothing seems to be happening when passing through the exit cube, which is tagged as “end”.

If anyone could help that would be great! Thanks in advance.

At least one of the objects needs to have a RigidBody component on it as well as a collider and you also need to have your collider marked as IsTrigger. See here: Unity Tips and Tricks