Destroy() not working on collision

Here is my script:

function Update()
{
	transform.position += transform.up * 20 * Time.deltaTime;
}
function OnTriggerEnter(other : Collider)
{
	if(other.gameObject.CompareTag("Enemy"))
	{
		Destroy(gameObject);
	}	
}

I do not have the slightest clue. I tried changing tags. They both have rigidbodies. Im shooting a prefrab at it with this:

var bullet:Transform;

function Update()
{
	if(Input.GetMouseButtonDown(0))
	{
		clone = Instantiate(bullet, transform.position , transform.rotation);
		Destroy(clone.gameObject,2.0f);
	}
}

They both have colliders and rigidbodies. I made sure everything was in place like the tag of enemy and stuff.

Are you sure that all of these functions are being called? You might try a few distinctive Debug.Log() calls to watch your code’s execution – say, log each time you create a bullet, each time the bullet hits something, each time you try to destroy the bullet, and so on.

Check what actually happens against your expectations, and you should have a better idea of what’s going wrong.

You could check the script reference for OnTriggerEnter() and make sure that you have things set up right. You mention that both objects have rigidbodies attached. Do they have colliders? What layer are those colliders on? Is one or more of the colliders a trigger?

Have you checked the ‘Is Trigger’ option in the colliders?

Your code is good, methinks.