Display Time At Game Over Scene

I have this time script:

#pragma strict
private var startTime : float;
var textTime : String;
//First define two variables. One private and one public variable. Set the first variable to be a float. 
//Use for textTime a string. 
function Start() {
startTime = Time.time;
}
function OnGUI () {
var guiTime = Time.time - startTime; 
//The gui-Time is the difference between the actual time and the start time.
var minutes : int = guiTime / 60; //Divide the guiTime by sixty to get the minutes.
var seconds : int = guiTime % 60;//Use the euclidean division for the seconds.
var fraction : int = (guiTime * 100) % 100;
 
 textTime = String.Format ("{0:00}:{1:00}:{2:00}", minutes, seconds, fraction); 
//text.Time is the time that will be displayed.
 GetComponent(GUIText).text = textTime;
 
}

Stars all falling and the player’s job is to destroy the stars by touching them and they cannot let one pass or they will lose the game. The score system is basically the time; how long they last. But, I’m having trouble with creating a game Over trigger and displaying the player’s highest time in the Game Over scene. How do I do it?

Move var guiTime to outside of your functions to make it a global

make an Update() function that checks guiTime and, if guiTime is > your time end, load the score scene.

be aware that score will be reset when the scene changes unless you make it a global static

Just wrap it in a boolean:

var gameOver : boolean;

function Update(){
   if(!gameOver){
      //do everything you listed in your script
   } else{
      //use the vars in (!gameOver) to get the time amounts to post here, but be sure not to include the accruing code. 
      //show the information of game over.
   }
}