Problem with destroy gameObject

Hi, I have this script:

var Lumber : int = 100;

function Update(){

if (Lumber == 0){
Destroy(gameObject);
}
}

So when the lumber is = 0 it will destroy all the same game object from my scene. But i want to destroy only one object, how do I do this ? Can you help me? Cheers!

Sounds like you've attached that to every Lumber object. You need local checks, not world checks, if you want to delete one at a time. I'd guess wherever you're decrementing Lumber is where you want to be deleting only the Lumber object that was just triggered.

Without any substantial details, though, that's the best you'll get - a guess.

Where is gameObject defined and how do you use it? May be this will help:

if ( Lumber == 0 && gameObject != null )
{
    Destroy( gameObject );
    gameObject = null;
}