Object reference not set to an instance of object (C#)

Hi,

I try to display my score in game but isn’t work .

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class affichescore : MonoBehaviour {

    private Lescore sco;

	// Use this for initialization
	void Start () {

        
    }
	
	// Update is called once per frame
	void Update () {
        sco = GetComponent<Lescore>();
        GameObject.Find("Text").GetComponent <Text>().text = "Ton score est : " + sco.scoreplayer;
	
	}
}

using UnityEngine;
using System.Collections;

public class Lescore : MonoBehaviour {
       
    public int scoreplayer = 0;
        
    void OnTriggerEnter(Collider col)
    {
        scoreplayer = scoreplayer + 1;
        print(scoreplayer);
    }
}

Help me please ( i’m french)

OOh i think i found the problem. You need to access the Text Mesh not the text. So something like this

GameObject.Find("Text").GetComponent <TextMesh>().text = "Ton score est : " + sco.scoreplayer;

it doesn’t work :frowning: