how do you add a script remotely?

How do you add a script to an object from another script? I have a script that detects a collision, adds a prefab in its location, deletes the object it collided with, deletes its own mesh renderer, but I can't figure out how to add a script to the prefab I just made.

The reason for the script is that I need two half papers to come together when they touch. After that the player needs to click on the whole paper to go to the next level.

Here is the script (don't comment on he correct language because I don't have access to the file right now)

var the prefab : gameObject(//wholepaper);

function OnCollisionEnter (mycollision : Collision) { if( == "PaperB"){ destroy(gameObject.Find("PaperB); destroy(getcomponent(meshrenderer)); var instance : GameObject = Instantiate(thePrefab, transform.position, transform.rotation); *(Add (nextlevel)script to wholepaper object); } }

If anyone could help, it would be much appreciated.

*the part of the code I need help with.