Instantiate a prefab

Hey everyone iv been making a medieval game and i recently been making a wall that when you hit the wall it will fall so i made this script but when i enter the trigger it carats more then one prefab so what i need help with is to make it that when i go in the trigger it changes prefab and only makes 1 new prefab.

var newObject : Transform;

function OnTriggerEnter (other : Collider) 
{
    Instantiate (newObject,transform.position, transform.rotation);
    Destroy(other.gameObject);
}

thanks :)

I think the problem is that you don't specify what kind of collider is allowed to trigger your script. Basically every collider that enters your trigger will fire the OnTriggerEnter event. You spawn your object at the center of your trigger (since this script is on your trigger "transform" relates to the trigger). If your prefab contains a collider the new object will fire the trigger again.

If you want just a special object like a bullet be able to fire the trigger, tag your object with the a tag like "bullet" and check for it :

var newObject : Transform;

function OnTriggerEnter (other : Collider) 
{
    if (other.gameObject.tag == "bullet")
    {
        Instantiate (newObject,transform.position, transform.rotation);
        Destroy(other.gameObject);
    {
}