Object Reference Error

I’m creating pickups that will modify my HUD text once they are picked up. Instead, they are just giving me object reference errors. Any tips would be appreciated!

    public void ModHealth(int _value)
    {
        CurHealth += _value;
        PlayerHUD.updateHealth(CurHealth);
    }

This is one of the examples of it going wrong. I have it Curhealth setup with a int as well as having a PlayerHUD reference. What could be the issue whenever I pick up an item?

So the problem seems to be that you are not declaring a reference to HUD like so

public HUD PlayerHUD; // this is set in the inspector

void Start()
{
    if (PlayerHUD == null)
    {
        Debug.LogError("The PlayerHUD property has not been set in the inspector. Please set now and try again.");
    }
}

or like this

private HUD PlayerHUD;

void Start()
{
    if (GetComponent<HUD>() != null)
    {
        PlayerHUD = GetComponent<HUD>();
    }
    else
    {
        Debug.LogError("Missing PlayerHUD component. Please attach one and try again.");
    }
}