Multiple clicks

Hello!

This script does what i want, but its missing one feature. i want it to have to be clicked 3 times before it will destroy the cube. But i don’t have the slightest idea on how to achieve it.

function OnMouseDown()
{
  Destroy(gameObject);
}

any help is greatly appreciated guys and gals!

You can use an integer variable to act as a simple click counter:

var amountOfClicks:int=0;
function OnMouseDown(){
  if(amountOfClicks>2){
    Destroy(gameObject);
  }
  else{
    amountOfClicks++;
  }
}