Need help for ui.text

Hello,
I’m doing a countdown timer and I have this code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Timer : MonoBehaviour {


    
    private float tempsRestant = 25; //Temps en secondes
    public Text text;
    

	// Use this for initialization
	void Start () {
        
	}
	
	// Update is called once per frame
	void Update () {
        tempsRestant -= Time.deltaTime;

        if(tempsRestant < 0)
        {
            text = tempsRestant.ToString();
            

        }
	}
}

But it doesn’t work with the .ToString with a UI.Text, how can I do it ?

In line 20 , you have to access the text variable in the Text component.
It should be text.text = tempsRestant.ToString();
and that should work !