HUD Problem

Hi ,
i’ve trying to gathering coin by mouse click and show total of coin number on HUD, but amount of coin that be gather and shown on hud is always 0 (zero) and does not change. please help .

Ok first of all, what is the Actor Reference in the Wool actor? Is that a reference of the HUD? Where do you set that? If it is the HUD, you can just get “PlayerController 0” and “GetHUD” and then cast it to your HUD Class to increment the int variable that is in the HUD Class.

Summary: Delete “ActorReference” variable in HUD Blueprint. Remove the whole “GetAllActorsOfClass” part.

Delete the “Number_Of_Coin” variable in your WOOL Blueprint, you don’t need that. It is already in the HUD. Also remove the “ActorReference” variable there too.

Get the PlayerController0. Get the HUD from it. Cast the HUD to your custom HUD BP. Get the Int variable from it and increment that.

Extra Information: Use an “IsValid” node for your Reference variable to make sure that they are not NULL (they can be empty if you don’t full them).

Avoid using “GetAllActorsOfClass”. This is an expensive node. Try to get the reference otherwise. For example by either Spawning the Actor and saving it directly in a variable.

OR (if the actor is already spawned) select it and create a directly reference in the LevelBlueprint

I rewrote the answer, since i did not really see the way you wanted to do this. Now it should be correct :X

thank you very much , your answer is correct , rewrote that as an answer please .

Awesome! (: I converted the comment to an answer and accepted it for you.
If you have more questions regarding this specific problem, feel free to reopen it and ask me.