Unity crashes when loading script

I got my script ready. But for some unknown reason unity crashes on activating the script.(No it does not give an error)
The code:

using UnityEngine;
using System.Collections;

public class score : MonoBehaviour {
    public GUIText scoreText;
    public float TimeScore;
    public lives livesScript;

    void Start () {
        TimeScore = 0;
        scoreText.text = "Time:0";
        StartCoroutine(newScore());
    }
  
    IEnumerator newScore () {
        while (true)
        {
            TimeScore = TimeScore + 1 * Time.deltaTime;
            scoreText.text = "Time:" + TimeScore;
        }
    }

    void Stop()
    {
        if (livesScript.Dead == true)
        {
            StopCoroutine(newScore());
        }
    }
}

I tested it and this script is what causes it. Any help?

not entirely sure but i think coroutines need a yield statement, try putting yield return null; in your while loop

It worked but it stopped to loop, it don’t want that. But I know the cause now thank you :smile:

i dont think it should stop the loop actually, just tried it and it doesnt for me

Thank you very much. I had it at the end before then it stopped but now it doesn’t!