C# how can I get an object to retreive a value of a variable of another object?

Hi I’m trying to get it to where when 2 of the player objects are too close to each other and both on the ground that they will destroy each other.

Both of them have a bool “airborn” but I don’t know how to make it so that I can retrive the airborn of the other player. Here is my code:

    var allfoes = GameObject.FindGameObjectsWithTag("PLAYERS");
    foreach(GameObject MYfoe in allfoes)
        {
        var dist=Vector3.Distance(transform.position, MYfoe.gameObject.transform.position);
        if (dist<.6f && MYfoe.gameObject!=gameObject && airborn && MYfoe.gameObject.airborn) Destroy(GameObject);

Scripts hold the variables. Scripts are components. Use GetComponent:

Whatever w = MYfoe.GetComponent<Whatever>();

Replace Whatever with the class of the script holding the variable. Then get the variable from w.airborne.

Thanks! Works like a charm!