Attempt to call function 'update_Coin_score' in base 'null instance' on null instance

Godot Version

godot 4


I got an error ‘Attempt to call function ‘update_Coin_score’ in base ‘null instance’ on null instance’. and These are my code!

How can I solve this problem?

if the coin is instantiated and added child to main scene, then just using $HUD wont be able to call the HUD, hence why null instance. to solve this, use signal

if you dont want to signal, you can simply throw the HUD reference to each new coins saved variable, which just doesnt feel right, but it works