Why I can't change the Boolean value in another class

After the prefab it instantiated, it cannot change the value of the Game Controller Class. Why?

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

public class MazeScript : MonoBehaviour
{

    public GameController gameController;

    public float moveSpeed = 5.0f;

    public Transform destroyPoint;

    // Update is called once per frame
    void Update()
    {
        transform.Translate(Vector3.back * moveSpeed * Time.deltaTime);
        if (transform.position.z <= destroyPoint.position.z)
        {
            Debug.Log("Can Destroy!");
            this.gameController.canRemoveFromList = true;
            Destroy(gameObject);
        }
    }
}

Hi,

I think the problem comes from the instantiated object not knowing where the GameController is.

You need to add a Start function on the instantiated object and tell it which object has the GameController script on it as a component. For example

void Start()
{
        gameController = GameObject.Find("GameController").GetComponent<GameController>();
}