Picking a Gameobject from a List with a value

Was just wondering how would I go about setting a gameobject active from a list of gameobject. The picked gameobject has the lowest value of a varibale in there script and the list needs to be in another script on another gameobject. I understand how finding the lowest value but having troubles with selecting a gameobject by that.
Example:

-Gameobjects all have the same script, that has a int that changes depending on certain behaviors

-have another gameobject that holds a script that will loop through the gameobjects and finds the one with the lowest value. Then this script will set the picked gameobject active.

Thank You

You first have to create a loop that will check it’s value.

private int refrenceInt;
private GameObject lowestGameObject; 

foreach(GameObject currentGameObject in listOfGameObjects)
{
    Component Value = CurrentGameObject.GetComponent("scriptOfGameObject");
    
    if(value.int < refrenceInt)
    {
//Needs some logic if refrence = value
        lowestGameObject = currentGameObject; 
        refrenceInt = value.int;
    }  
}