Help with editing text in-game.

I wish to include a score keeper in my game, but I’m having trouble getting a script to modify the text in a textbox in-game.

Whenever I try to edit the text through a script, I receive this error:
“Type ‘UnityEngine.Component’ does not contain a definition for ‘text’ and no extension method ‘text’ of type ‘UnityEngine.Component’ could be found. Are you missing an assembly reference?”

Here’s my current script if anyone’s wondering:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//Spaceholder
public class ScoreUpdate : MonoBehaviour {


private Component ScoreKeeper;

void Start () {
	ScoreKeeper = GameObject.Find("ScoreKeeper").GetComponent<Text>();
	if (ScoreKeeper == true){
		Debug.Log("I found the scorekeeper!");
		}
	ScoreKeeper.text = "test";	//Test Message

	}
	
void Update () {
	
	//ScoreKeeper.text = "test"; //Not being used.
	
	}
}

If anyone knows what’s wrong, please let me know, a lot of the answers that are already on this site don’t even work for me. Thanks.

Yup, the problem is the type of ScoreKeeper which right now is Component. While it is true that Text is a component and thus you can assign it to the ScoreKeeper variable, you cannot access any of the Text methods since it is a more specialized version of the Component class.

To solve it just change the type of the ScoreKeeper variable from Component to Text