What am I doing wrong in this script?

I am trying to make it so that when a person completes a level, they can calculate how long they took to complete the level. I get this error: The name ‘time’ does not exist in the current context. I have a GUIText called time. I still get this error though. I have changed it in the script. Here is my script:

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour 
{
public float timerAccuracy = 0.1f; //How frequently will the timer update? Time in seconds.
public bool timerActive = true; //Set this to false when you want to stop the timer
public string textBeforeSeconds = "Time: "; //If you don't want the text before the timer, leave it blank.
public string textAfterSeconds = " seconds"; //If you don't want the text after the timer, leave it blank.
 
private float currentTime; //The actual time since timerAcive was true
 
IEnumerator Start () 
	{
    currentTime = 0; //Time is set to 0 at the start
    //Set the appropriate text to the GUI Text
    guiText.text = time;
    while (true) 
		{ //Will loop, and preform much like Update()
        if (timerActive) 
		{
            //Add (timerAccuracy) to the actual time, every (timerAccuracy) seconds
            yield return new WaitForSeconds(timerAccuracy);
            currentTime += timerAccuracy;
            guiText.text = time;
        }
        yield return null;
    	}
	}
}

Are you trying to reference Time.time?

The name ‘time’ does not exist in the current context.

Just so. Your script can’t compile because the compiler has never heard of a variable named “time”.

I notice there’s a variable named “currentTime” (did you mean to use that?).

If you’re trying to reference another script, component, or GameObject, you’ll need to get a reference to it, first. You could populate that reference with an inspector variable, or with some mix of GameObject.Find() and GetComponent().