How to code a script to go to the next scene after winning a round?

what to do to move to the next scene when the player wins the round and not when the mouse button is pressed. I am mainly referring to this passage
This is my code for scene switching:

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

public class LevelLoader : MonoBehaviour
{
    public Animator transition;

    public float transitionTime = 1f;

    // Update is called once per frame
    void Update()
    {
        if(Input.GetMouseButtDown(0))
        {
            LoadNextLevel();
        }
    }

    public void LoadNextLevel()
    {
        StartCoroutine(LoadLevel(SceneManager.GetActiveScene().buildIndex + 1));
    }

    IEnumerator LoadLevel(int levelIndex)
    {
        transition.SetTrigger("Start");

        yield return new WaitForSeconds(transitionTime);

        SceneManager.LoadScene(levelIndex);
    }

}

And this is my code that controls the whole game:

using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;


[RequireComponent(typeof(GameUI))]
public class GameController : MonoBehaviour
{

 
    public static GameController Instance { get; private set; }

    [SerializeField]
    private int knifeCount;

    [Header("Knife Spawning")]
    [SerializeField]
    private Vector2 knifeSpawnPosition;
    [SerializeField]
    
    private GameObject knifeObject;

    
    public GameUI GameUI { get; private set; }

    private void Awake()
    {
        
        Instance = this;

        GameUI = GetComponent<GameUI>();
    }

    private void Start()
    {
        
        GameUI.SetInitialDisplayedKnifeCount(knifeCount);
        
        SpawnKnife();
    }

    
    public void OnSuccessfulKnifeHit()
    {
        if (knifeCount > 0)
        {
            SpawnKnife();
        }
        else
        {
            StartGameOverSequence(true);
        }
    }

    
    private void SpawnKnife()
    {
        knifeCount--;
        Instantiate(knifeObject, knifeSpawnPosition, Quaternion.identity);
    }

   
    public void StartGameOverSequence(bool win)
    {
        StartCoroutine("GameOverSequenceCoroutine", win);
    }

    
    private IEnumerator GameOverSequenceCoroutine(bool win)
    {
        if (win)
        {
            
            yield return new WaitForSecondsRealtime(0.3f);
            
        }
        else
        {
            GameUI.ShowRestartButton();
        }
    }

    public void RestartGame()
    {
        
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex, LoadSceneMode.Single);
    }
}

Given the code you already created i don’t really get the question. You simply need a reference to your LevelLoader instance. Either by assigning it to a member variable in your GameController or by adding a static Instance reference to your levelLoader or by FindObjectOfType.

Then you just have to call LoadNextLevel() right?

Please add more details to your question if you need more specific help with something.

do you mean it?

if (win)
         {
             FindObjectOfType<LevelLoader>.LoadNextLevel();
             yield return new WaitForSecondsRealtime(0.3f);
             
         }

because it doesn’t work