I want to stop the game by displaying the phrase "Game Over" when the hp gauge reaches zero.

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

public class ArrowController : MonoBehaviour
{
public GameObject GameOverObject;
GameObject player;

// Start is called before the first frame update
void Start()
{
    this.player = GameObject.Find("player");
    
}

// Update is called once per frame
void Update()
{
    
    transform.Translate(0, -0.1f, 0);

    
    if(transform.position.y<-5.0f)
    {
        Destroy(gameObject);
    }

    
    Vector2 p1 = transform.position;              
    Vector2 p2 = this.player.transform.position; 
    Vector2 dir = p1 - p2;
    float d = dir.magnitude;
    float r1 = 0.5f;                             
    float r2 = 1.0f;                             

    if(d<r1+r2)
    {
        GameObject director = GameObject.Find("GameDirector");
        director.GetComponent<GameDirector>().DecreaseHp();

        Destroy(gameObject);
       
    }
}

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

public class GameDirector : MonoBehaviour
{
GameObject hpGauge;
GameObject gameover;
float circleAmount;
// Start is called before the first frame update
void Start()
{

    this.hpGauge = GameObject.Find("hpGauge");
    this.gameover = GameObject.Find("Gameover");
    circleAmount = 1.0f;
}

// Update is called once per frame
public void DecreaseHp()
{
    this.hpGauge.GetComponent<Image>().fillAmount -= 0.1f;
    circleAmount -= 0.1f;
   
    if(circleAmount==0)
    {
        this.gameover.GetComponent<Text>().text="Game Over !";
    }
}

}

@SpRingLJM your variable circleAmount maybe become less than 0. The Update() may occur again within milliseconds and by the time the DecreaseHP() is actually called, it has fallen bellow 0. And since you are only checking if it’s equal to 0 exactly then it might never trigger the “if” statement.