How to get float value from other script?

Hi, (Sorry for my bad English)
I wrote script that change item which I’m holding:

  void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            ItemInHand = 1;
            Item1.SetActive(true);
            Item2.SetActive(false);
        }
}

And another script:

void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            text.enabled = true;
            intree = true;
            Debug.Log("In trigger.");
            if (Input.GetKeyDown(KeyCode.E) & ###ItemInHand = 1###)
            {   
                text.enabled = false;
                Invoke("one", 0.3f);
            }
        }
    }

How to get ItemInHand value in second script?

There are some cases:

case 1: your classes are in the same object.

  public class MyClass1 : MonoBehaviour
  {
        public float _itemInHand = 0; //public field
  }

 public MyClass2 : MonoBehaviour
 {
       private void Start()
       {
           var class1 = GetComponent<MyClass1>();
           class1._itemInHand = 3;

        }
 }

Case 2: your classes are in diferents objects

 public class MyClass1 : MonoBehaviour
 {
       public float _itemInHand = 0; //public field
 }

public MyClass2 : MonoBehaviour
{
      private void Start()
      {
          var class1 = GameObject.Find("MyObject").GetComponent<MyClass1>();
        class1._itemInHand = 3;
      }
}

What i did was a seperate class which was a "public static class " which kept all my variables to use in more than one script. Then to access that variable you do the name of the class then “.” with the variable name. For example myclass.variable . Hope that helps.