Instantiate prefab OnTriggerEnter

I would like to Instantiate a rock prefab to fall from the sky when you enter a trigger, then be destroyed after a few seconds.

I am having trouble getting it to work though. I have made a prefab rock with rigid body. I have made a collider marked as trigger and added this java script.

var rock : GameObject;

    function OnTriggerEnter (other : Collider) 
        var clone : GameObject = Instantiate (rock, transform.position, transform.rotation);

What you have, assuming it’s on the collider object, will destroy that collider when you enter it, just making sure you want to do that.

It will also put the rock in the same place that the collider object was. My guess is you want to put it a few unit above that? Like:

Instantiate (rock, transform.position+Vector3.up*3, transform.rotation);

Figured it out. I was dumb and had the script on both the Rock and the Trigger.