Pause button not working correctly

Hello

I am writing a pause button for my game (Game for mobile phones).

My Pause script:

using UnityEngine;
using System.Collections;

public class PauseScript : MonoBehaviour {

    public bool paused;
    // Use this for initialization
    void Start () {
        paused = false;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))    
        {    
            paused = !paused;
        }

        if (paused)    
        {    
            Time.timeScale = 0;   
        }    
        else if (!paused)    
        {    
            Time.timeScale = 1;
        }
    }

    public void Pause()    
    {
        paused = !paused; 

        if (paused)
        {    
            Time.timeScale = 0;
        }
        else if (!paused)
        {    
            Time.timeScale = 1;
        }
    }
}

And Jump that is written like this jump = Input.GetButton(“Fire1”);

When I touch button my player jumps and the game does not pause.

How I can make my game pause and player doesn’t jump?

try this

public class PauseController : MonoBehaviour {


	bool paused = false ;
	
	// Use this for initialization
	void Start () {
	
		//First set the canvas to false
	}
	
	// Update is called once per frame
	void Update () {
			//every frame this function will be called
			pauseGame ();
	}


	public void pauseGame()
	{		
		
		if (Input.GetButtonDown ("AnyButton")) {
			paused = true ;
		}

		if (paused) {
			canvas.SetActive (true);
			Time.timeScale = 0;
		}
	}

	// call this function on button click on the UI button 
	public void Unpause(){
		paused = false;
		if (!paused) {
			canvas.SetActive (false);
			Time.timeScale = 1;
		}

	}
	
}