,Im trying to create a money counter that goes up by 1 when I destroy the object

I’m trying to set it up so that when I destroy the game object “money” the UI counter goes up by any number (I dont care if it’s 1 or 100). When I Destroy the object the number doesn’t increase. Thanks in advance!

using UnityEngine;
using UnityEngine.UI;

public class moneyCounter : MonoBehaviour
{
    public GameObject money;
    public Text moneyAmount;
    private int score;
    // Update is called once per frame
    void Update()
    {
        moneyAmount.text = "$" + moneyAmount;
        if (money != null)
        {
            moneyAmount.text = moneyAmount.text + 1;
        }
    }
}

,
using UnityEngine;
using UnityEngine.UI;

public class moneyCounter : MonoBehaviour
{
public GameObject money;
public Text moneyAmount;
private int score;
// Update is called once per frame
void Update()
{
moneyAmount.text = “$” + moneyAmount;
if (money != null)
{
moneyAmount.text = moneyAmount.text + 1;
}
}
}

To your money GameObject you could attach a script the calls IncreaseMoney on the Money Counter script when it´s deleted.

Money GameObject Script:

public class Money : MonoBehaviour {

GameObject go; //reference to other go

private void Start()
{
go= GameObject.Find("insert your moneycounter go here"); // finds go
}

private void OnDestroy() // gets called when object is destroyed
{
go.GetComponent<MoneyCounter>().IncreaseMoney(1); // increases money by one
}
}

Script on money counter:

public class MoneyCounter : MonoBehaviour{

	public Text moneyAmount;
    private int score; // current money amount

public void IncreaseMoney ( int moneyToAdd)
	{
		moneyAmount.text = "$" + ( score + moneyToAdd ); // calculate new money and set it to text
	}
}

Don´t forget to assign all the variables!

@pgr4567 Thank you for your help I can tell i’m getting closer but im receiving an error that says:
“NullReferenceException: Object reference not set to an instance of an object
clicktoDestroy.OnDestroy ()”

public class clicktoDestroy : MonoBehaviour
{
    
    public Text moneytext;
    private int moneyamount;
    public GameObject money;
    
    private void Start()
    {
        moneyamount = 0;
        money = GameObject.Find("Money");
    }
   
    //To set the amount of money being added
    void SetMoneyAmount()
    {
        moneytext.text = "$" + moneyamount.ToString();
    }

    private void OnMouseDown()
    { 
        Destroy(gameObject);
    }
    private void OnDestroy()
    {
        Debug.Log("+Money!");
        money.GetComponent<MoneyCounter>().IncreaseMoney();
    }

}

The moneyCounter

public class MoneyCounter : MonoBehaviour
{
    public GameObject money;
    public Text moneytext;
    private int score;
    public void Start()
    {
       
    }
    public void IncreaseMoney()
    {
        moneytext.text = "$" + (score + 1);
    }
        
    }
    

EDIT: I'm pooling the money object and destroying the clones.