Getting number of seconds a user has been in game

I can’t get the text ui to display the number of seconds the user has been in the game

public Text time;
private int value = 0;
 void Start () {
	textloop();
}

// Update is called once per frame
void Update () {
	
}

public IEnumerator textloop()
{
	while (true)
	{
		yield return new WaitForSeconds(1);
		time.text = "Time: " + value.ToString();
		value++;
	}
}

}

@CraftingStudio12 I don’t know what is wrong with your script but you can use Time class for this, Specifically in your case

Time.realtimeSinceStartup

Use DateTime instead.

When he enters, grads the current time and then you can just compare:

public class EntryClass:MonoBehaviour
{
      private DateTime entryTime;
      void Awake()
      {
             this.entryTime = DateTime.Now;
      }
      public double GetTimeInGameSeconds()
      {
             return (Date.Now - this.entryTime).TotalSeconds;
      }
}