Destroy object when hit by other object

how can i determine if my object cube(tag as target) is hitted by my bullet(tag as bullet)

because i want to destroy each cube im hitting with my bullet..

i have a code place in a cube but the cube is destroyed right after it hit the floor

function OnCollisionEnter(theCollision : Collision){
if(theCollision.gameObject.tag=="bullet");
Destroy(gameObject);

Try this:

function OnCollisionEnter(theCollision : Collision){
   if(theCollision.gameObject.tag=="bullet") {
     Destroy(gameObject);
   }
}

You had a ; after your if. That caused a Destroy on each collision.