Back button help please

I created a back button for the options menu.
But when i press the back button, nothing happened. I want go back to main menu.

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

public class MainMenu : MonoBehaviour
{
   //ublic Text HStext;
  
   /*ivate void Start()
    {
        HStext.text = "Score Time" + PlayerPrefs.GetIn();
    }*/
    public void PlayGame()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);    }
  
    public void QuitGame()
    {
        Debug.Log("QUIT");
        Application.Quit();
    }
}

Line 16 goes to the NEXT scene after this one, with the +1, not the previous scene.

Instead of using numbers to load scenes, since those can change, just put the name of the scene in that LoadScene() call, as a string surrounded by double quotes:

SceneManager.LoadScene("WhateverMyMainMenuSceneIsCalled");

If that’s not it, then all I can suggest is liberally sprinkling Debug.Log() statements through your code to display information in realtime.

Doing this should help you answer these types of questions:

  • is this code even running? which parts are running? how often does it run?
  • what are the values of the variables involved? Are they initialized?

Knowing this information will help you reason about the behavior you are seeing.