I’m checking if the player is dead in void update and if it is a 3 second countdown starts and I’d like to play an audio clip once in that time

void Update () {
    if (player == null)
    {
        gameOverText.gameObject.SetActive(true);
        GetComponent<AudioSource>().Play();

        restartTimer -= Time.deltaTime;
        if (restartTimer <= 0f)
        {
            SceneManager.LoadScene("Game");
        }
    }
}

restart timer is 3f btw. How do I make the clip play only once when this happens?

private bool audioPlayed = false;
void Update () {
if (player == null)
{
gameOverText.gameObject.SetActive(true);
if (!audioPlayed)
{
GetComponent().Play();
audioPlayed = true;
}

            restartTimer -= Time.deltaTime;
            if (restartTimer <= 0f)
            {
                SceneManager.LoadScene("Game");
            }
        }
    }