Enemy health. Need to take damage from two different bullet prefabs

Hi guys

I need for an enemy to take damage from two different bullet prefabs.

bullet and bullet1.

var health : int = 100;
var prefab : Transform;
var sound : AudioClip;
var Points : Transform;

function OnCollisionEnter (hit : Collision) {
    if(hit.gameObject.CompareTag("bullet") {
        health -= 25;

    if(hit.gameObject.CompareTag("bullet1")) {
        health -= 15;
    if (health <= 0) {

        var instanceBullet=Instantiate(prefab, transform.position, Quaternion.identity);

        var instanceBullet1=Instantiate(Points, transform.position, Quaternion.identity);

The problem is my enemy only gets destroyed with the first prefab bullet. And the second prefab bullet1 doesn’t destroy the enemy.

Any help would be appreciated.

Hm… I edited your post to fix code formatting. Perhaps I fixed the bug by mistake. Because now I cannot find anything wrong with your code.
What would have caused it would be if you had written

if (health == 0) {

Since 254 is 100, and the health would therefore reach exactly 0, but 157 is 105, which would mean that the health would go to -5 directly. So an exactly == 0 check would fail. I was too quick fixing the formatting so I don’t know if there was a < symbol there (some of the code was converted to html entities).

Otherwise you just have to check if the other bullet really has a “bullet1” tag. Make sure the object with the collider has it, not some other GameObject which might be connected to the bullet.