How Do I get the component of individual objects with same tag using On Trigger Enter.

I have 2 objects. Object A and Object B both the same with a Walking script attached and both with the same tag. What is supposed to happen is that if I enter Objects A collider, Objects A walking script is disabled, and If I enter Objects B collider, Objects B walking script is disabled. The script works for only 1 object, not two where if I enter Objects B collider, objects A walk script is disabled, and not Objects B. I realized that it only worked for one Object but I don’t know how to make it work for both of the objects. I would really appreciate the help.

{

	// Use this for initialization
	


    public GameObject Titan;
  

  

    private bool InTrigger = false;
	// Update is called once per frame
	void Update () {
        if (InTrigger)
        {
         
         
            Titan.GetComponent<TitanMove>().enabled = false;
            
            
          
            Titan.GetComponent<UnityEngine.AI.NavMeshAgent>().enabled = false;
        }
        if (!InTrigger)
        {
          
            Titan.GetComponent<UnityEngine.AI.NavMeshAgent>().enabled = true;
            Titan.GetComponent<TitanMove>().enabled = true;
          
     
         
         
    
           
           
        }
	}

    public void OnTriggerEnter(Collider other)
    {
        if(other.tag == "Titan")
        {
            InTrigger = true;
        }
    }
    public void OnTriggerExit(Collider other)
    {
        if(other.tag == "Titan")
        {
            InTrigger = false;
        }
    }

I would approach what you’re trying to do in the exact opposite way. Try having the objects (a and b) sense when they enter the trigger, and disable themselves.