Player can no longer attack enemies with one is destroyed.

I’ve made it so that my player can successfully attack and kill an enemy however if one enemy is killed he can no longer target the others, since he found the enemy by a tag. How can I make it so that he can continue to fight other enemies?
Here’s my script:
using UnityEngine;
using System.Collections;

public class CatchJellyFish : MonoBehaviour {
public float Timer;
public float coolDownSwing;

public GameObject jellyFish;


public void Start()
{
    Timer = 0;
    coolDownSwing = 1.0f;
	
	jellyFish = GameObject.FindGameObjectsWithTag("JellyFish");
}

public void Update()
{
    if (Timer > 0)
        Timer -= Time.deltaTime;

    if (Timer < 0)
        Timer = 0;
	
	float distance = Vector3.Distance(jellyFish.transform.position, transform.position);

	if(Input.GetButton("Action1") && Time.timeScale != 0)
	{			if (Timer == 0)
    	{
			Timer = coolDownSwing;
			if(distance < 8f)
			{
				JellyFishHealth jellyHealth = (JellyFishHealth)jellyFish.GetComponent("JellyFishHealth");
				jellyHealth.AdjustCurrentHealth(-1);
			}
		}
	}
}

}

First, you are assigning jellyFish’s value in the Start function (so, at the beginning of the game), and you aren’t going to update it in the future. So, if new enemies are generated, jellyFish variable remains useless, because its value won’t change.

As a second point, FindGameObjectsWithTag returns a list: this means that you have to search, in that list, for the particular enemy that’s closest to the player.

As a solution for both the problems, update jellyFish in the Update function, and use a routine that finds, during time, the closest enemy. In the Script Reference, there’s an example that does exactly that.