Array of bool doesn't change in other script

the code is :

using UnityEngine;
        using UnityEngine.UI;
        public class InventorySlot : MonoBehaviour {    // Scrpit A
        
        public bool[] buttonState = new bool[2];
        
        void Update ()
        	{
        		if (Input.GetKeyDown (KeyCode.Alpha1) || Input.mouseScrollDelta.y > 0)
        		{
        			buttonState [0] = true;
                                buttonState [1] = false;
        		}
                    if (Input.GetKeyDown (KeyCode.Alpha2) || Input.mouseScrollDelta.y < 0)
        		{
        			buttonState [0] =  false;
                                buttonState [1] = true;
        		}
    
    public bool ButtonIsActive (int index)
    	{
    		return  buttonState[index];  // true or false from the update funaction
    	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 using System.Collections;
    using UnityEngine;
    
      public class CollectShiled : MonoBehaviour {   // Scrpit B
        	public InventorySlot inventory;    // I put it in the incpector
    void Update ()
      {
          if (Input.GetKeyDown ("space") &&  inventory.ButtonIsActive(index))  // index =1 or 0 
        			    {
        				   // Do something 
        			    }
        }

the problem is in the script A always return true !

    public bool ButtonIsActive (int index)
   {
      return  buttonState[index]; 
    }

If you want it to be only true if the key is held down you have to Input.GetKey Instead and create an else statement that sets the bools to false.