You may be using a different type than is being assigned.
Text when using TextMeshPro objects. Use TextMeshProUGUI or TMP_Text instead.Text refers to the legacy UI text1.See the valid references diagram to understand what locations can reference each other.
If you're unsure how to reference one location from another, refer to the how-to section.
If you have a script selected you are not looking at the correct location to assign references.
Select a GameObject or asset (such as a prefab or scriptable object) and assign the reference to an instance.

Take care to add the correct namespace.
Most IDEs will help you reference the appropriate namespaces by providing quick actions when your caret is on the relevant block of code. Visual Studio has Quick Actions, Visual Studio Code has Quick Fixes, and Rider has Intention Actions.↩