StartCoroutine mess

seems like StartCoroutine() will only work for my Resume() function. All the others dont call it.

public void Restart()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        pauseState = false;
        StartCoroutine("bruh");
    }

    public void Resume()
    {
        StartCoroutine("bruh");
        resumeGame = true;
        gameOverCanvasRestartAndPause.gameObject.SetActive(false);
        gameOverCanvasRestart.gameObject.SetActive(false);
        pauseState = false;
        start = true;
    }
////////////////////////////////////////////////////////////////////
    public void startGame()
    {
        pauseState = false;
        Debug.Log("hhhhh");
        StartCoroutine("bruh");
        SceneManager.LoadScene("Game");
    }

    public void exitGame()
    {
        SceneManager.LoadScene("Menu");
    }

    IEnumerator bruh()
    {
        yield return new WaitForSecondsRealtime(1);
        Time.timeScale = 1;
        Debug.Log("sfs");
    }
}

When you load a new level all previous gameobjects get destroyed and with them any coroutine which is running on those gameobjects. If you want a coroutine to live beyond a levelload you have to use DontDestroyOnLoad to prevent that the gameobject is automatically destroyed. However keep in mind that when this object is part of the scene itself you will load another one when you reload the scene and your objects would stack up each time you load a new scene. A simple Singleton that survives a load would actually be enough. You can use this singleton and create an additional class like this:

public CoroutineHost : MonoBehaviourSingleton<CoroutineHost>
{
    public static Coroutine StartCoroutine(IEnumerator aIterator)
    {
        return Instance.StartCoroutine(aIterator);
    }
}

Note that you don’t have to attach this script anywhere. It will automatically create an instance of itself which will continue to live throughout your whole game, even across level loads. So from anywhere you can simply do:

CoroutineHost.StartCoroutine(yourCoroutine());

So in your case you can simply do:

CoroutineHost.StartCoroutine(bruh());

Note that using the string version of StartCoroutine should never be used for several reasons. First of all it’s error prone since you can easily mistype your coroutine name. The same happens when you rename your coroutine. The compiler can’t catch those errors. Apart from the obvious that using a string is slower, with the string version you can only start coroutines which are defined on the same gameobject / in the same script.

your 2 gameObjects listed in resume don’t have a Script with timeScale = 0f. ???