Code for a loading screen doesn't work

So I am really new to C# scripting and just wanted to create a loading screen for my game. I copied off of a youtuber (Solo Game Dev) and smth pops up about the IEnumerator. any help is appreciated.

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class LoadingScript : MonoBehaviour
{
    public GameObject LoadingScreen;
    public Image LoadingBarFill;

    public void LoadScene(int sceneId)
    {
        StartCoroutine(LoadSceneAsync(sceneId));
    }

    IEnumerator LoadSceneAsync(int sceneId)
    {
        
        AsyncOperation operation = SceneManager.LoadSceneAsync(sceneId);

        LoadingScreen.SetActive(true);

        while (!operation.isDone)
        {
            float progressValue = Mathf.Clamp01(operation.progress / 0.9f);
            LoadingBarFill.fillAmount = progressValue;
            yield return null;
        }
    }
}

Whenever I save the code unity replies with a bug that states “the type or namespace name ‘IEnumerator’ could not be found (are you missing a using directive or an assembly reference?)” and I really don’t know

Need to add a “using System.Collections;” at the top of the file since IEnumerator is in the System.Collections namespace.

Cheers mate it’s well appreciated :smiley: