I wrote the code exactly as Rick said at the lesson but I got stuck with a nagging error " NullReferenceException: Object reference not set to an instance of an object"
So instead of using
scoreText = GetComponent<TMP_Text>();
I used
scoreText = GetComponentInChildren<TMP_Text>();
and that simply fixed the error since the score bored is a child of Canvas.