Destroy a gameobject created with Instantiate?

I can’t seem to get my gameobject to destroy itself. I’ve created a prefab and attached a script to it. In the script’s update function I have if(destroy){Destroy(transform.gameObject);}. Another script calls Instantiate on the prefab. I’ve also tried passing transform.parent and just transform to Destroy, but the object always persists. I also print out “destroyed” after I call Destroy in the if, and it prints out, so I know it’s getting called. I’m not sure what I’m missing.

I might not have been specific enough. The script with the Destroy is attached to the prefab. Another script with a public variable, declared like “var myprefab : Transform”, is calling Instantiate(myprefab).

destroy in the prefab’s script is set to true when it’s been alive for the passed in amount of time. I just user Timer.time to count down its lifetime. The idea is to get the instantiated game object to take care of destroying itself, instead of some observer.