How to use a foreach loop to disable scripts on objects within a GameObject array?

I have a script that gets all objects in the scene with the tag ‘villager’ and stores them in a GameObject array. i want to loop over these objects and disable a script that is stored on each of them, how would i go about doing this?

 private void Awake()
    {
        selectedUnitRTSList = new List<UnitTargeter>();
        selectionAreaTransform.gameObject.SetActive(false);
        GameObject[] villagers = GameObject.FindGameObjectsWithTag("Villager");
        Debug.Log(villagers.Length);
       
        foreach (GameObject obj in villagers)
        {
            
        }

Cheers in advance

Hi @WookieMilk

if you want to disable a script, you can use the obj.GetComponent<SCRIPTNAME>() function. This returns an object which you can then deactivate by using SetActive(false).

You can find additional information here