My timer freezes everytime I leave the scene and come back.

my timer code:

#pragma strict
private var initialtime : float;
private var texttime : String;
var CountMinutes : int;
var CountSeconds : int;
private var restseconds : int;
private var minutes : int;
private var seconds : int;
var guitime : float;

function Start () {
	CountSeconds = CountSeconds + (CountMinutes*60);

function OnGUI () {
	guitime = Time.time - initialtime;
	restseconds = CountSeconds - guitime;
	seconds = restseconds%60;
	minutes = restseconds/60;
	texttime = String.Format("{0}:{1}",minutes, seconds);
	GetComponent(GUIText).text = texttime;

		if(seconds <=0 && minutes <=0)
			//Pause the game
			Time.timeScale = 0;


I have this script on another object that loads a new scene then in that scene there is a button that lets me go back to the timer scene again then when I am in the timer scene the timer just doesn’t move. I don’t get why. But theres this other button that loads another scene and if I return to the timer scene the timer would work fine. Does anyone have any ideas? Thanks

Check if the Start method is called every time a scene loads. Things dont get called when you use DontDestroyOnLoad() method.