Change text value

I am just starting to write C# and i would use Javascript if i could because my knowledge about C# specifically is “small”.

So, i have a UI Text, and i am trying to make it add 1 to the score each time the player clicks a button. For example, the score is 0. The player clicks the button, and it is changed to one. If he clicks again, it changes to two and it continues. I have tried A LOT OF THINGS but i always got myself in the same two problems: i can’t reference something or i can’t understand how it works so i can make it. I think i am in the right path, but i couldn’t really find anything related to how to reference texts and how to make a variable for it, and i am also struggling in making a trigger for it.

Here is my code for now:

using UnityEngine;
using System.Collections;

public class ObjClick : MonoBehaviour
{
    bool click = false;

    public GameObject fall;
    public GameObject txt; //I wanted to use this variable to hold the text, but as i said i couldn't reference it. There isn't exactly something like "public Text txt".
    public Animator anim;
    public int score;

    void Start()
    {
        fall.SetActive(false);
    }


    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            anim.SetTrigger("Action");
            fall.SetActive(true);
            //I plan to make something like, on left mouse click, add one to the score.
        }
    }

    void UpdateScore()
    {
        txt.text = score; // <- This is my main problem. I don't know how to reference the text. I always get the error "Type 'UnityEngine.GameObject' does not contain a definition for text" etc...
    }
}

Could someone help me to finish this? It’s very important. Any help would be appreciated. Btw this is my last question.

To start, Include UnityEngine.UI so write using UnityEngine.UI on top of your script.

Next, change public GameObject txt; by public Text txt;
In the editor, drag your text object into the text slot of your script.

Access your text of your Txt object by typing txt.text = 'blah blah text'.
For displaying numbers, you need to convert them to a string first, so write

txt.text = yourNumberVariable.ToString()

txt.GetComponent<UnityEngine.UI.Text>().text = score.ToString();

@Zitoox The text box is in the inspector panel of Unity. Thought I would state this as the OP comment posted that

There isn’t exactly something like “public Text txt”.