The type or namespace name Text could not be found. Are you missing UnityEngine.UI using directive?

I am getting this error while trying to display Text. This is my Code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerControls : MonoBehaviour {

public float speed;
public Text countText;
public Text winText;

private Rigidbody rb;
private int count;

void Start ()
{
	rb = GetComponent<Rigidbody>();
	count = 0;
	SetCountText ();
	winText.text = "";
}

void FixedUpdate ()
{
	float moveHorizontal = Input.GetAxis ("Horizontal");
	float moveVertical = Input.GetAxis ("Vertical");

	Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

	rb.AddForce (movement * speed);
}

void OnTriggerEnter(Collider other) 
{
	if (other.gameObject.CompareTag ( "Pick Up"))
	{
		other.gameObject.SetActive (false);
		count = count + 1;
		SetCountText ();
	}
}

void SetCountText ()
{
	countText.text = "Count: " + count.ToString ();
	if (count >= 12)
	{
		winText.text = "You Win!";
	}
}

}

Firstly it didnt worked for me cause I was getting other error. I fixed those error by coping code from Roll a Ball tutorial cause I am doing it now. But I am stuck here. Please help

add this in the top of your script, just after "using UnityEngine:

using UnityEngine.UI;

Import Unity UI package in Windows->package Manager->Unity Registry-> Unity UI

shut down the projects and reopen it and let the magic happen updates may not be completed

For anybody encountering this error using Unity 2022, include:
using TMPro;
at the top of your script.

Then your text variable should use TMP_Text, like this:
public TMP_Text yourText;

Here’s a detailed tutorial on it: