Help with health script

Hey guys, I know that this has probably been asked a hundred times before: How can i manage it to subtract the enemy’s helth with a shot from the player´s gun?

For example 2.5 from 10 lifepoints?

Im not good with coding at all, so i`d be happy with all kind of help, especially an exemple script. here´s mine:

var enemyHealth = 10;
public var Damage = 2.5;
function update(){
    function OnCollisionEnter(hit : Collision){
        var  enemyHealth - Damage;
    }
        if enemyHealth == 0;
        destroy.GameObject;
}

Thanks for all!

I don’t know javascript, but there are several things you want to change i bet.

First take the collision function outside of update.
Second you don’t need to write var inside the OnCollisionEnter because you already declared it. Also you need to check in the collision what actually did the hit i believe.
I believe it’s best to go and search a tutorial. Specially because you just started.

At first: thank you for your response, i´ve been searching around for nearly two weeks but i didnt find ANYTHING that worked how i imagined, because the shooting script (1 hit from the bullet → -1 health point) i have doesnt work on any other script from the Web… PS: I use the “Basic Weapon System 1.0” package (Which is AMAZING) from the asset store (and the scripts)