Calling a bool from another script doesn't seem to be working

I’m trying to have a piece of code run when a ball hits a trigger(to finish the stage) in an attempt to get the timer to stop running and add it to a score.

public class Finish_Cube : MonoBehaviour

public bool levelFin = false;

private void OnCollisionEnter(Collision collision)
    if (collision.gameObject.tag == "Player")
        print("Level complete!");
        levelFin = true;

public class Timer : MonoBehaviour

Finish_Cube finishCube;

public int time;
public bool _running;
public Text timerText, failText;
public int timeToScore;

private void Awake()
  finishCube = GameObject.Find("FinishGameObject").GetComponent<Finish_Cube>();

void Start()
    _running = true;
    failText.text = "";
IEnumerator countdown()
    while (time > 0)
        yield return new WaitForSeconds(1);
        time -= 1;
    failText.text = "LEVEL FAIL";
    _running = false;
private void Update()
    if (finishCube.levelFin)   //here
        timeToScore = time;


    timerText.text = "Time: " + time.ToString();


Are you receiving any errors with this code? Have you confirmed that finishCube = GameObject.Find(“FinishGameObject”).GetComponent(); is finding the game object, and getting the component?

If there is only one instance if an object with a Finish_Cube component, try changing that list to this…

finishCube = FindObjectOfType<Finish_Cube>();

See if that makes any difference.

Hope this helps,