Hi guys I made a checkpoint script see below BUT I cannot seem to work out how to show the laptime after each lap completed ? can anyone help please ,its probably very simple but as you can probably tell from my script ,I am a Javanoob
heres the code
var time : float; var lapTime : float; var ckp = 0; var lap = 0; function OnGUI(){ GUI.Box (Rect (10,10,110,100), "Racetime:" + time); GUI.Box (Rect (120,120,110,100), "Checkpoint : " + ckp/2); GUI.Box (Rect (240,10,110,100), "Laps" + lap); if (lap==1) GUI.Box (Rect (540,10,400,100), "Laptime:" + (lapTime - time)); // This Shows as Zero ? if (lap==2) GUI.Box (Rect (540,10,200,100), "You WON !"); } function OnTriggerEnter(hit : Collider){ if(hit.gameObject.tag == "Checkpoint1") ckp=ckp +1; if(hit.gameObject.tag == "Checkpoint2") ckp=ckp +1; if(hit.gameObject.tag == "Checkpoint3") ckp=ckp +1; if(hit.gameObject.tag == "Checkpoint4") ckp=ckp +1; if(hit.gameObject.tag == "Checkpoint5") ckp=ckp +1; if(hit.gameObject.tag == "Checkpoint6") ckp=ckp +1; if(hit.gameObject.tag == "Checkpoint7") ckp=ckp +1; if(hit.gameObject.tag == "Checkpoint8") ckp=ckp +1; if(hit.gameObject.tag == "Checkpoint9") ckp=ckp +1; if(hit.gameObject.tag == "Checkpoint10") ckp=ckp +1; if (ckp==20) lap=1; if (ckp==40) lap=2; if (ckp==60) lap=3; if (ckp==80) lap=4; if (ckp==100) lap=5; }