Pause function not working?

I’m making a pause button for a game that will enable a game object and its children when the user clicks a certain rectangle (initially they’re disabled). However, whenever I click the rectangle, nothing happens and I can’t seem to figure out why. Here’s my code:

void Update () {
        if (Input.GetMouseButtonDown (0)) {
            if (buttonRect.Contains (Input.mousePosition)) {
                Time.timeScale = 0.0f;
                PauseScreen.gameObject.SetActive (true);
            } else {
                Debug.Log("Else");
            }
        }
    }

Thanks for any answers!

I would use standard Unity buttons, then you don´t have to check for mouse button clicks or track button positions in the code.
Search for “unity button tutorial”