Click destroy script help

I want to click to destroy an object with the script attached, but I get an error with the script saying

BCW0022: WARNING: Boolean expression will always have the same value.

Also, every time I go into the game the objects already destroyed

sorry if its a very easy to spot mistake im fairly new to scripting
here is the script. Thanks :slight_smile:

#pragma strict
var objectC :GameObject;

if (Input.GetMouseButtonDown);
Destroy(this.transform.gameObject);

Are you trying to destroy objectC or the object that is is attached to? Also

if (Input.GetMouseButtonDown) {
     Destroy(this.transform.gameObject);
}

is how to get an if-then statement to work. You need to use the brackets in order to have the script do something if certain conditions are met.

if (Input.GetMouseButtonDown(0)){    //0  = left mouse button, 1 = is right, 2 = middle
    Destroy(this.transform.gameObject);
}

the object that the script is attached to
I was going to try something but then I changed my mind and forgot to remove it

In that case you don’t even need this.transform, you can just use Destroy(gameObject); (the g in gameObject may need to be capitalized, try it and if it yells at you just make it G)