I need help I want to do a game over text after a certain score and I put it in a script that destroys objects and it seems to me that there is a problem

this the script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DestroyOutOfBounds : MonoBehaviour
{

public GameObject text;

private int topBorder = 40;
private int bottomBorder = -5;
public int i = 0;

// Start is called before the first frame update
void Start()
{
    text.SetActive(false);
}

// Update is called once per frame
void Update()
{
    if (transform.position.z > topBorder)
    {
        Destroy(gameObject);
        

    }

    if (transform.position.z < bottomBorder)
    {
        Destroy(gameObject);
        i++;
    }

    if (i > 3)
    {
        text.SetActive(true);
    }
    
}

}

Game Over text:

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

public class PlayerMovement : MonoBehaviour
{
     public int score;
     public Text scoreText;
     
     public void Start() 
     {
           scoreText.SetActive(false);
     }

     public void Update()
     {
           //earn score code here

           //check score
           if(score == 2) 
           {
                  scoreText.SetActive(true);
                  scoreText.text = "Game Over!";
           }
     }
}

I don’t get exactly what you’re saying, this is just my guess at what your I think your asking…

have you thought to put a delay on the script

yield return new WaitForSeconds(0.2f);