I need a variable to change on every click

Hello Community I need help getting a var (Woodnum) To change when OnClick is called.

#pragma strict
var theTextComponent : UI.Text;
var Wood : UI.Text;
var Woodnum = 1;


function Start () {
	
}

function Update () {
	
    Wood.text = "Wood" + Woodnum;
   
}
function OnMouseDown () {
	
    Destroy(gameObject);
    
    theTextComponent.text = "+1 Block";
    
    Woodnum = Woodnum + 1;
}

When you call Destroy(gameObject), then the current object will be destroyed and it will never reach the rest of your code. Put line 18 after line 22.

EDIT:

Remove your update function and replace your OnMouseDown function with this:

function OnMouseDown()
{
    Woodnum += 1;

    Wood.text = "Wood" + Woodnum;
    theTextComponent.text = "+1 Block";
    
    Destroy(gameObject);
 }