Pause menu not working???

When ever i am using the pause menu it wont let me use anything after clicking something other than the remume button (that one works) but when i hit options or the main menu button unity thinks it is paused again forcing me to hit escape again but then it thinks it is paused and resumed at the same time…,I have the game paused and everything works just fine but as soon as I click an action liek the options menu or the quit button they both think the game is paused. The resume button works just fine but thats because im resuming the game but when i hit options i cant click anything and same with the main menu…

here is the code that i used

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Pause : MonoBehaviour {

//public static bool GameIsPaused = false;
static bool GameIsPaused = false;

public GameObject pauseMenuUI;

// Update is called once per frame
void Update () {
	if(Input.GetKeyDown(KeyCode.Escape))
        {
        if (GameIsPaused)
        {
            Resume();
        }
        else
        {
            DoPause();
        }
    }
}

public void Resume ()
{
    pauseMenuUI.SetActive(false);
    Time.timeScale = 1f;
    GameIsPaused = false;
}

void DoPause ()
{
    pauseMenuUI.SetActive(true);
    Time.timeScale = 0.0f;
    GameIsPaused = true;
}

public void LoadMenu()
{
    pauseMenuUI.SetActive(false);
    GameIsPaused = false;
    Time.timeScale = 1f;
    Application.Quit();
    SceneManager.LoadScene("menu");
}

}

Don’t use Time.timeScale for pausing the game. Time scale is used by a lot of things including coroutines and therefore setting it to 0f can make a lot of things stop working. In you place I would use GameIsPaused public and use it to check if for example the player can be updated.