Check Points?

How would I Implement a “Points” System into this code. Basically I want it to go to the next scene when all the boxes have been deleted. I know i need a var “something” : int; but i dont know how to make it add +1 everytime one guy gets deleted.

(This script is added to each block so when it is clicked, It gets deleted.)

var destroy;

function Start(){
destroy = false;
}

	function OnMouseOver(){
		if(Input.GetMouseButtonUp(0)){ 
		destroy = true;
	}else{
		destroy = false;
	}
}

		function Update(){
		if(destroy){
	Destroy(gameObject);
		}		

}

Something like this? :slight_smile:

Game.js

static var dudesLeft : int = 0;
Dude.js

function Awake() {
 Game.dudesLeft += 1;
}

function DestroyDude() {
 Game.dudesLeft -= 1;
 if ( Game.dudesLeft <= 0 ) {
  // nextlevel
 }
}

Thank You!! that worked perfectly