displaying score on pause

I want to display the score the player has score until now when he presses pause button, but for some reason it doesnt print it. heres the scripts responsible
public float distance;
public Transform player;
public Text label;
public float distanceTravelled;
float lastPosition;

	void Start () {

		lastPosition = player.transform.position.y;

	}
	
	// Update is called once per frame
	void Update () {
		distanceTravelled = player.transform.position.y - lastPosition;
		label.text = distanceTravelled.ToString ("F0");

		} 		

}

pause:

	public Text label;
	private DistanceSystem anotherScript;
		// Use this for initialization
	public void printScore(){
		anotherScript = GetComponent<DistanceSystem> ();
		label.text = anotherScript.distanceTravelled.ToString ("F0");
	}
	void Start () {
	}
	
	// Update is called once per frame
	void Update () {


	}

and every click on the pause button it does printScore() but it doesn’t work

public DistanceSystem anotherScript;//drag the gameobject in inspector which having script name Distance system

public void printScore()

{

     //anotherScript = GetComponent<DistanceSystem> ();
     label.text = anotherScript.distanceTravelled.ToString ("F0");
     Debug.Log("pause score= "+anotherScript.distanceTravelled);

}

replace this and check if you get any error or you get debug output in console?? if error than paste that error here