How do I change scenes from my credits to my main menu using a trigger.

I made my credits scroll up but I don’t know how to to make it wait a few seconds before changing to my main menu.

public float secondsToWait;
bool creditsEnded;

if(creditsEnded){
    StartCoroutine("ReturnToMenu");
}

IEnumerator ReturnToMenu(){
    yield return new WaitForSeconds(secondsToWait);
    LoadMainMenu();
}

When the credits are finished start wait for (secondsToWait) seconds then call the function “LoadMainMenu”. That’s how i would do it.