How to use a sphereCollider in order to detect target then have it run away

I’m trying to make a zombie vs human simulator, but I can’t quite get the human to detect the zombie/zombies in the area using the tag “Zombie”, while they are in the Human’s Sphere Collider. Here is the Code:

using UnityEngine;
using System.Collections;

	public class Z_Run : MonoBehaviour {

	// Use this for initialization
	public int vBubble = 100;
    Transform target;
	public int speed = 10;
	bool isStay;
	void Start () {
	
	}

	void OnTriggerStay (Collider other) {
		isStay = true;
	}

	
	// Update is called once per frame
	void Update () {
		findTarget ();
		transform.LookAt (target); 
		transform.Rotate (180, 0, 180); 
		transform.Translate (Vector3.forward * speed * Time.deltaTime, Space.Self); 
		}
	void findTarget () {
		if (isStay) {
			target = GameObject.FindGameObjectWithTag("Zombie").transform;
				}
		}
}

using UnityEngine;
using System.Collections;

public class Z_Run : MonoBehaviour
{
	public int vBubble = 100;
	public int speed = 10;
	
	private Transform target;
	
	void Update()
	{
		if(target)
		{
			transform.LookAt(target);
			transform.Translate(Vector3.forward * speed * Time.deltaTime);
		}
	}
	
	void OnTriggerStay(Collider other)
	{
		if(other.tag == "Zombie")
			target = other.transform;
	}
}

No offense but your code really needed heavy work! Start on an easier project and learn how to properly code and organize it. This is really important.

Replace your whole script with mine. Also, make a new tag and call it “Zombie” then set your Zombie character to that tag. Then the script should work properly.