Initialize a script - timer

Hello so i have this timer script, that is atached to a main game controller. And i’d like to start it when i get close to a specific object. I thought i could do something like this:

if(closeToCube) var timer = new Timer(); print(timer.time);

But this isn’t working, so whats the correct way to initialize a script again and again, and stop it in the meantime ?

var text : GUIText;
var timer : float;

function Update(){

while(insideTriggerArea){

	timer += 1 * Time.deltaTime;
	text.text = "" + timer;

}

}