Multiple enemies not working

Hi

I have made a enemy that can deal damage to the player and eventually kill him. The enemy is working really good. But I am wondering how I can make a fool-proof script so I can deal damage to the enemy (NOTE: This is not a game with guns, I am using ranged damage. If the enemy is withing the range and I press “hit” then it deals damage). It works when I have a single enemy, but it doesn’t work with multiple enemies. So how can I make a script that supports multiple enemies?

I’d make something like

Function OnCollisionEnter( hit : collision)
{
If(hit.gameobject.name = “(name of enemy here without parenthesis)”
{
(script that does damage goes here)
}
}

I’m a novice scripter but I think this will work.