Multiple click on cube to destroy it, script help please:)

Hello ive made a cube (wall) and my ultimate goal is to have the player break the wall by clicking it multiple times within a set amount of time. For now though, all Im looking for is help with this script.

using UnityEngine;
using System.Collections;

public class wallscript : MonoBehaviour {

var amountOfClicks:int=0;

function OnMouseDown(){

if(amountOfClicks>5){
Destroy(gameObject);
}
else{
amountOfClicks++;
}
}
}

It continues to give me the error regarding the colon in
β€œβ€œvar amountOfClicks:int=0;””

GOT IT TO WORK! Whew.

1 Like