OnTriggerStay only applying to one object

Im working on a AI combat system where each AI has a secondary collider with “Trigger” enabled. here is my script so far

   public float health = 100;
    public int isrunning = 1;
    public GameObject currenttarget;
    public int attackspeed;
    public int damage;
    public int newdamage = 0;
    void Start()
    {
        StartCoroutine(DoDamage());
        
    }

    public void TakeDamage(float x)
    {
        this.health = this.health - x;
    }

    public IEnumerator DoDamage()
    {
        isrunning = 0;
        yield return new WaitForSeconds(attackspeed);
        Debug.Log("loop");
        newdamage = damage;
        isrunning = 1;
    }



    private void OnTriggerStay(Collider other)
    {
        if ( other.gameObject.CompareTag("AI"))
            {
            other.GetComponent<Framework>().TakeDamage(newdamage);
            newdamage = 0;
        }

    }

    private void Update()
    {
        if (isrunning==1)
        {
            StartCoroutine(DoDamage());
        }
    }


    // Update is called once per frame

}

When I place three objects with this script where there damage is set to 5 and attack rate to 1, The result that I want out of this would be:
A.100
B.100
C.100
(1 Second)
A.80
B.80
C.80
However what I find is that the other.GetComponent().TakeDamage is only applying to one object at a time rather then being applied to the other two objects as I want.
is this how the OnTriggerStay should be working? and if so are there any workarounds for this?

well. I think if you’re placing various colliders at the same time, only one of them will activate the trigger.
I think the solution is to write:

void OnTriggerStay(Collider[] cols){

 foreach(Collider c in cols){

  if(c.tag == "AI"){

  // do damage stuff

  }

 }

}

This way, every frame a collider is TOUCHING the trigger, it’s gonna be detected, and the damage will be applied.

But this is not really good, at all. I think the best solution would be to create a array of colliders (where you’re going to place all the colliders that touch the trigger), then, using OnTriggerEnter, add them to the array, and remove them by OnTriggerExit. So you can use a foreach every time you want to apply damage to the colliders. This is a way better solution, since the performance will be optimized.

If you don’t know what’s a foreach or any other thing I said here, would be really good if you search and learn by yourself. It’s way easier to learn when you know exactly what you’re learning, and why.

I’m sorry for my bad english! Hope I helped you someway.