How can I make one int equal an int from another script?

I want to make my character’s health be determined by how many of the currency they have, kind of like rings in sonic games (If you have one ring or more, you survive a hit; if less than one, you die). How do I do that here:

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

public class GameManager : MonoBehaviour
{
    public int moneyAmount;
   
    public void AddMoney(int moneyToAdd)
    {
        moneyAmount += moneyToAdd;
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HealthManager : MonoBehaviour
{
    public int currentMoney;
    public int maxHealth;
    public int currentHealth;
    // Start is called before the first frame update
    void Start()
    {
        currentMoney = 0;
        currentHealth = 1;
    }

    // Update is called once per frame
    void Update()
    {
        //currentMoney = [moneyAmount in GameManager script]
        if (currentRings > 0)
        {
            currentHealth = 2;
        }
        else
        {
            currentHealth = 1;
        }
    }
}

Best practice would be not to have multiple copies of the same information that you need to keep in sync. Instead, where you need to use that value, keep a reference to the owner of the value and read it directly from there. This concept is called “single source of truth” Single source of truth - Wikipedia

It keeps you from writing a bunch of error prone code to keep more than one variable in sync unnecessarily.

For example, in HealthManager, you should simply have a reference to your GameManager and read the current amount of money directly from there, instead of creating a copy of the same value in HealthManager that you would need to keep in sync all the time.

As for how to get a reference to your GameManager from your HealthManager, this video explains several excellent ways to do so:

Thank you, I managed to make it work!