Help with OnTriggerEnter Issue

Hi im making a sidescroller game. When you fall off the level you die and it resets the level with this script here

`#pragma strict
var player : GameObject;

function OnTriggerEnter(player : Collider){
	if(player.tag =="Player");
	Destroy(player.gameObject);
	Application.LoadLevel(Application.loadedLevel);
}
	
`

This is all fine and dandy. The issue is I have movable cubes you can push around. Now if you push one of those cubes off the edge instead of the PlayerRespawn collider ignoring it and only deleting objects with the tag “Player” it deletes the cube and reloads the level. If you guys can see any errors in my code can you please help? Or any advice with how to do this in a more efficient way would be much appreciated. If you have any questions about my code in helping you understand it please ask. Thanks a lot for all of your help, it’s a strong programming community that makes games that much better.

I have a friend who once awoke from a nightmare shouting “Semi-colon” - you have the same problem :slight_smile:

Your if statement does nothing (because of the semi-colon) what you want is this:

function OnTriggerEnter(player : Collider){
    if(player.tag =="Player") {
        Destroy(player.gameObject);
        Application.LoadLevel(Application.loadedLevel);
    }
}