How to parent to an array?

I’m instantiating objects and trying to parent them if the conditions are met to an object in the array.
Confused, what am I missing.

public class SpawnBlock : MonoBehaviour
{
    public GameObject[] BlockOne;
    public GameObject[] Parent;

    void OnMouseDown()
    {


        Parent = GameObject.FindGameObjectsWithTag ("TileNew");
        BlockOne = GameObject.FindGameObjectsWithTag ("Blocks");

        foreach (GameObject r in Parent)
        {
            if (r.GetComponent <NewTiles> ().NewTileSpawned == 0) {
                //Parenting BlockOne to Parent that has NewTileSpawned == 0 in the array
                BlockOne.transform.SetParent (Parent);
                transform.localPosition = new Vector3 (0, 0, -1);

            }
        }

        }

}

Line 17 BlockOne.transform.SetParent (Parent); gives me this :
Assets\CustomScripts\SpawnBlock.cs(25,14): error CS1061: ‘GameObject[ ]’ does not contain a definition for ‘transform’ and no accessible extension method ‘transform’ accepting a first argument of type ‘GameObject[ ]’ could be found (are you missing a using directive or an assembly reference?)
I tried to change GameObject to Transform in the Parent declaration but it gives even more errors.

You can’t be parented to more than one object.

Do you mean to parent it to your local variable r.transform ?

Yes to r, not trying to parent one object to other at the same time :smile:
So basically the script goes through the loop of the array and if one of the objects in the array meets the condition BlockOne should be child of it.
Can’t make it work.

Ok, sorted out with this, here is the correction in case someone needs it:

    void OnMouseDown()
    {


        Parent = GameObject.FindGameObjectsWithTag ("TileNew");
        BlockOne = GameObject.FindGameObjectsWithTag ("Blocks");

        foreach (GameObject r in Parent)
        {
            if (r.GetComponent <NewTiles> ().NewTileSpawned == 0) {
                //Parenting BlockOne to Parent that has NewTileSpawned == 0 in the array
                foreach (GameObject s in BlockOne){

                    s.transform.parent = r.transform ;
                transform.localPosition = new Vector3 (0, 0, -1);
                }
            }
         }
        }