NullReferenceException: Object reference not set to an instance of an object (675340)

HUHUHU HELLO~ can you please help me?? i’m trying to make a visual novel. its the 1st time trying to code. im following a tutorial, but weirdly im having errors when im following the tutorial step by step.
help a newbie please~

here’s my DialogueParserScript:

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine.UI;
using System.IO;
using System.Text.RegularExpressions;
using UnityEngine;

public class DialogueParserScript : MonoBehaviour {

    List <DialogueLine> lines;

    public string dialogue;
    public Text contentsTxt;
    public int lineNum;


    struct DialogueLine {
        public string name;
        public string content;
        public int pose;

        public DialogueLine(string n, string c, int p)
        {
            name = n;
            content = c;
            pose = p;
        }

    }

    // Use this for initialization
    void Start () {
        contentsTxt = gameObject.GetComponent<Text>();
        string file = "";
        string sceneNum = EditorApplication.currentScene;
        sceneNum = Regex.Replace (sceneNum,".unity", ".txt");
        file += sceneNum;
   
        lines = new List<DialogueLine>();


        LoadDialogue(file);

        dialogue = "";
        contentsTxt.text = "";
        lineNum = 0;

     /*   Debug.Log(lines[0].name);
        Debug.Log(lines[0].content);
        Debug.Log(lines[0].pose);*/
    }

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

        if (Input.GetMouseButtonDown(0))
        {
            dialogue = GetContent(lineNum);
            Debug.Log(lines[lineNum].content);
            contentsTxt.text = dialogue;
            lineNum++;
        }

    }

    void LoadDialogue(string filename){

        string file = "C:/Users/gabe/Documents/UnityGame/_INYTSMC/Assets/Resources/" + filename;
        string line;
        StreamReader r = new StreamReader(file);

        using (r){
            do
            {
                line = r.ReadLine();
                if(line != null)
                {
                   string[] line_values = line.Split('|');
                    DialogueLine line_entry = new DialogueLine( line_values[0],line_values[1], int.Parse(line_values[2]));
                    lines.Add(line_entry);

                }
               

            }
            while (line != null);
            r.Close();


        }
       


    }

    public string GetName(int lineNumber)
    {
        if (lineNumber < lines.Count)
        {
            return lines[lineNumber].name;
          
        }
        return "";

    }

    public string GetContent(int lineNumber)
    {
        if (lineNumber < lines.Count)
        {
            return lines[lineNumber].content;


        }
        return "";

    }

    public int GetPose(int lineNumber)
    {
        if (lineNumber < lines.Count)
        {
            return lines[lineNumber].pose;

        }
        return 0;

    }

}

the error is
NullReferenceException: Object reference not set to an instance of an object
DialogueParserScript.Start () (at Assets/Resources/Scripts/DialogueParserScript.cs:47)

also in line 61 T^T

thank you~

Considering the same error occurs in line 47 (or 46) and 61, it’s most-likely the member variable ‘contentsTxt’ which has not been set, which means

contentsTxt = gameObject.GetComponent<Text>();

does not find a text component.

Consider to either drag and drop the Text component in the inspector or ensure you’ve got the Text component on the same GameObject.