Trying to trigger something on collision.

I’m making a basic thing for class. What i am trying to do is this. When i throw a ball and it connects with the collision of the box i have, i want it to disappear and have my shattered box prefab come up. The problem i am having is the colision. I can’t get this script to work. Can anyone help? Using javascript.

var remains: GameObject;
function OnCollisionEnter (collision : collision) 
if (Collision.gameObject == something);
function Update()
{
	{
     		Instantiate(remains, transform.position, transform.rotation);
             Destroy(gameObject);
     }
 }

Your script makes no sense.

Two problems with this line:

 if (Collision.gameObject == something);

First, I don’t see “something” defined anywhere.
Secondly, it has no body just a ; at the end so it does nothing even if true.

This line also appears to do nothing:

function OnCollisionEnter (collision : collision) 

You really need to get yourself a book on basic Javascript or read through a coding tutorial. This looks like cut and paste by someone who had no idea what they were cutting and pasting.