Buttons not working

hi I created a simple code for when you press a button you get taken back to the main menu screen however when I input it into the button the function that I wrote doesn’t appear and I’m unable to make the button work because nothing seems to change idk if there is a better way to make it so that when you press a button it takes you to the menu but I’m still pretty new so I’m still very lost in some aspects of coding and unity in general.

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

public class MainMenu : MonoBehaviour
{
    public void ReturnMenu ()
    {
        SceneManager.LoadScene("Menu");
    }
}

You need to attach your MainMenu script as a component to the MainMenu object. I don’t see a MainMenu component attached in your inspector.