Health not deducting when hit by multiple targets?

I have this working health script but it only deducts health when there is one zombie in range not when there is multiple of them. I wan it to deduct say 2 when there is two zombies and 10 when theres 10?

using UnityEngine;
    using System.Collections;
    public class Health : MonoBehaviour {
    	private float maxHealth = 100f;
    	public float curHealth = 100f;
    	private float width = 150f;
    	private float height = 35f;
    	public GUITexture HealthBar;
    	private float time = 0;
    	private GameObject zombie;
    	private eHealth damage1;
    	// Use this for initialization
    	void Start () {
    		//Start of Health bar
    		HealthBar.pixelInset = new Rect(Screen.width/-2.1f, Screen.height/2.25f, width, height);
    		zombie = GameObject.FindGameObjectWithTag("Zombie");
    		damage1 = zombie.GetComponent<eHealth> ();
    	float newHealth (float damage){
    		curHealth = curHealth - damage;
    		return curHealth;
    	// Update is called once per frame
    	void Update () {
    		//Percentage of health
    		float per;
    		per = curHealth/maxHealth;
    		//New Bar Called when loss of health
    		HealthBar.pixelInset = new Rect(Screen.width/-2.1f, Screen.height/2.25f,width * per, height);
    		time += Time.deltaTime;
    		float dis = Vector3.Distance (zombie.transform.position, transform.position);
    		if (time >= 2f) {
    			time = 0f;
    			if (dis<=2f)
    				newHealth (damage1.damage);
    		if (curHealth >= maxHealth)
    			curHealth = maxHealth;
    		if (curHealth <= 0)
    			curHealth = 0;
    		if (curHealth <= 0)
    			Destroy (gameObject);

You should really have the distance check on the zombie’s script which cause the damage to the player though it’s definitely possible not to.

On line 19 you’re storing a reference to only one zombie instead of all zombies within the scene,

change line 12 to be an array to store all the zombies

private GameObject[] zombies;

line 19 should then get all zombies

zombies = GameObject.FindGameObjectsWithTag("Zombie"); //notice the S in Objects

on line 21, now store each component rather than just the one you have (this is why it’ll be best to have this in the zombie script)
then you’ll want to iterate through all the zombies stored and determine which are close enough instead of just the original one you had before. Add in line 41

foreach(GameObject zombie in zombies){

Then terminate the foreach loop on line 49


On line 13 you only store the damage of one zombie, if they’re causing different amounts of damage then you’ll also need to store those components in an array and then iterate through to see how much damage is being done by the relevant component (OR using indices to store the component index, OR finding it’s position within the array, OR iterating using the index of each zombie rather than using foreach, with many other options).

You’ll probably find it easier, though more work required now to store the player GO in each zombie GO and have simpler referencing for damage and future methods.