Can't seem to figure out how to get my UI to update the score based on a function

How would one display the UI if it wasn’t based on a game position, and a result of a function:
Ex.
player transform Player;
public text scoreText
(scoreText.text = player.transform.y.ToString();
EX END------------------------------------------------------- ^^^^

My code------------------------------------------------------BELOW

private float score = 0.0f;


public void AddScore(int value)
{
score += value; Debug.Log("Score = " + score);

}

private void OnTriggerEnter(Collider other)
{
// Once the steak collides with an animal it is deleted
Destroy(gameObject);
// Now both objects are deleted upon collison
Destroy(other.gameObject);

if (other.gameObject.CompareTag(“Animal”))
{
scoreManager.AddScore(3);
}

void Update()
{
scoreText.text = score.ToString();
}

I’m obviously skipping a lot, but hopefully it’s helpful enough. The problem is the text just stays at 0 in the game screen because it is displaying the variable and not the data from the function.

The only thing I can think is to have the AddScore function not be a void, but i’m not super sure what else I could make it. When I did float it gave me an error code of “Not all code paths return a value”