Cannot convert 'UnityEngine.Collider[]' to 'UnityEngine.Collider'

I was following tutorial, but with twist, that I created everything in 3D space. I managed to do that, until I needed a collider in 3D. I figured out, that it’s array not single game object in 3D. How can i solve it or at least work around it? I used all my ideas and I’m still in the same point.

Error is at line 96.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LevelGeneration : MonoBehaviour
{
    public Transform[] startingPosition;
    public GameObject[] rooms; // index 0 -> LR, I1 -> LRB, I2 -> LRT, I3 -> LRTB
    public float moveAmount;

    private int direction;

    private float timeBtwRoom;
    public float startTimeBtwRoom = 0.25f;

    public float minX;
    public float maxX;
    public float minZ;
    private bool stopGeneration;

    public LayerMask room;
    public Vector3 boxRadius;

    // Start is called before the first frame update
    void Start()
    {
        int randStartingPos = Random.Range(0, startingPosition.Length);
        transform.position = startingPosition[randStartingPos].position;
        Instantiate(rooms[0], transform.position, Quaternion.identity);

        direction = Random.Range(1, 6);
    }

    private void Update()
    {
        if (timeBtwRoom <= 0 && stopGeneration == false)
        {
            Move();
            timeBtwRoom = startTimeBtwRoom;
        }
        else
        {
            timeBtwRoom -= Time.deltaTime;
        }
    }

    void Move()
    {
        if (direction == 1 || direction == 2) // Move RIGHT
        {
            if (transform.position.x < maxX)
            {
                Vector3 newPos = new Vector3(transform.position.x + moveAmount, transform.position.y, transform.position.z);
                transform.position = newPos;

                int rand = Random.Range(0, rooms.Length);
                Instantiate(rooms[rand], transform.position, Quaternion.identity);

                direction = Random.Range(1, 6);
                if (direction == 3)
                {
                    direction = 2;
                } else if (direction == 4)
                {
                    direction = 5;
                }
            } else
            {
                direction = 5;
            }

        }
        else if (direction == 3 || direction == 4) // Move LEFT
        {
            if (transform.position.x > minX)
            {
                Vector3 newPos = new Vector3(transform.position.x - moveAmount, transform.position.y, transform.position.z);
                transform.position = newPos;

                int rand = Random.Range(0, rooms.Length);
                Instantiate(rooms[rand], transform.position, Quaternion.identity);

                direction = Random.Range(3, 6);
            }
            else
            {
                direction = 5;
            }
        }
        else if (direction == 5) // Move DOWN
        {
            if (transform.position.z > minZ)
            {

                Collider roomDetection = Physics.OverlapSphere(transform.position, 1, room);

                if (roomDetection.GetComponent<RoomType>().type != 1 && roomDetection.GetComponent<RoomType>().type !=3 )
                {
                    roomDetection.GetComponent<RoomType>().RoomDestruction();
                }

                int randBottomRoom = Random.Range(1, 4);
                if (randBottomRoom == 2)
                {
                    randBottomRoom = 1;
                }
                Instantiate(rooms[randBottomRoom], transform.position, Quaternion.identity);

                Vector3 newPos = new Vector3(transform.position.x, transform.position.y, transform.position.z - moveAmount);
                transform.position = newPos;

                int rand = Random.Range(2, 4);
                Instantiate(rooms[rand], transform.position, Quaternion.identity);

                direction = Random.Range(1, 6);

            }
            else
            { //Stop level Generation
                stopGeneration = true;
            }
        }
    }
}

Check the docs for OverlapSphere. It return array of colliders touched, not single one

Change line 96 to :

Collider[] roomDetections = Physics.OverlapSphere(transform.position, 1, room);

OverlapSphere return array not a single.

Then after line 96 add a new line and make a foreach maybe :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LevelGeneration : MonoBehaviour
{
    public Transform[] startingPosition;
    public GameObject[] rooms; // index 0 -> LR, I1 -> LRB, I2 -> LRT, I3 -> LRTB
    public float moveAmount;

    private int direction;

    private float timeBtwRoom;
    public float startTimeBtwRoom = 0.25f;

    public float minX;
    public float maxX;
    public float minZ;
    private bool stopGeneration;

    public LayerMask room;
    public Vector3 boxRadius;

    // Start is called before the first frame update
    void Start()
    {
        int randStartingPos = Random.Range(0, startingPosition.Length);
        transform.position = startingPosition[randStartingPos].position;
        Instantiate(rooms[0], transform.position, Quaternion.identity);

        direction = Random.Range(1, 6);
    }

    private void Update()
    {
        if (timeBtwRoom <= 0 && stopGeneration == false)
        {
            Move();
            timeBtwRoom = startTimeBtwRoom;
        }
        else
        {
            timeBtwRoom -= Time.deltaTime;
        }
    }

    void Move()
    {
        if (direction == 1 || direction == 2) // Move RIGHT
        {
            if (transform.position.x < maxX)
            {
                Vector3 newPos = new Vector3(transform.position.x + moveAmount, transform.position.y, transform.position.z);
                transform.position = newPos;

                int rand = Random.Range(0, rooms.Length);
                Instantiate(rooms[rand], transform.position, Quaternion.identity);

                direction = Random.Range(1, 6);
                if (direction == 3)
                {
                    direction = 2;
                }
                else if (direction == 4)
                {
                    direction = 5;
                }
            }
            else
            {
                direction = 5;
            }

        }
        else if (direction == 3 || direction == 4) // Move LEFT
        {
            if (transform.position.x > minX)
            {
                Vector3 newPos = new Vector3(transform.position.x - moveAmount, transform.position.y, transform.position.z);
                transform.position = newPos;

                int rand = Random.Range(0, rooms.Length);
                Instantiate(rooms[rand], transform.position, Quaternion.identity);

                direction = Random.Range(3, 6);
            }
            else
            {
                direction = 5;
            }
        }
        else if (direction == 5) // Move DOWN
        {
            if (transform.position.z > minZ)
            {

                Collider[] roomDetections = Physics.OverlapSphere(transform.position, 1, room);

                foreach (Collider roomDetection in roomDetections)
                {
                    if (roomDetection.GetComponent<RoomType>().type != 1 && roomDetection.GetComponent<RoomType>().type != 3)
                    {
                        roomDetection.GetComponent<RoomType>().RoomDestruction();
                    }

                    int randBottomRoom = Random.Range(1, 4);
                    if (randBottomRoom == 2)
                    {
                        randBottomRoom = 1;
                    }
                    Instantiate(rooms[randBottomRoom], transform.position, Quaternion.identity);

                    Vector3 newPos = new Vector3(transform.position.x, transform.position.y, transform.position.z - moveAmount);
                    transform.position = newPos;

                    int rand = Random.Range(2, 4);
                    Instantiate(rooms[rand], transform.position, Quaternion.identity);

                    direction = Random.Range(1, 6);
                }

            }
            else
            { //Stop level Generation
                stopGeneration = true;
            }
        }
    }
}