How to make a cooperative system that shares the same hud

I have two characters under the same parented class, set up with a flip flop to switch between the two. I am trying to make a cooperative system that will share the same hud for picking up coins in the level. Right now, the flip flop works fine in possessing each character. But, I noticed the coin counter is dependant on which character picks up the coins. I.E. Char1 picks up 100 coins, then I switch to Char2. The coin counter then says 0 coins. He picks up 10 coins. I switch back to Char1, and the coin counter returns to show 100 coins. Is there a way to make this so any coins picked up, no matter which character is possessed will add to the same counter?

I need this to happen because one of the objectives in the level is to pick up a set total of coins.

Keep track of the coins collected in either the player controller or the player state.

How would I set that up exactly? Still trying to learn the ins and outs of blueprints, sorry.

Use “GetPlayerController” and cast this to your Custom PlayerController Blueprint, that you either already have created
or that you might want to create right now (you need to set this to the Default ControllerBlueprint Class in your GameMode Blueprint).
Then, in your custom PlayerController Blueprint, create your Score variable and after casting it (the GetPlayerController and Cast happens
in both Characters, so you could put this logic in their Parent Class) you get the variable, add 1 to it and set it again.

Now you can access your Controller Class also in the HUD and since both character save the score in the same Controller, you will
have the summed up value.

You could also use the PlayerState Class which is more suited for this. You will do this same thing with Creating your own PlayerState
Class with PlayerState as a Parent and set it as the default PlayerState class in your GameMode. You can access this ClassActor
over the PlayerController. Just do this: GetPlayerController->GetPlayerState->Cast PlayerState To your CustomPlayerState->Change Score

So pretty much the same, but only another class that was made for saving scores.

Thank you! That worked perfectly using the player state!

Tried to post this earlier, but it didn’t show up. Sorry if it ends up posting twice…

So, all of a sudden, my player state stopped working. Kept getting an “Accessed NONE error” whenever I would try to pick up coins, and nothing would add to the total in the counter. I thought it was possibly just a currupt file, so I duplicated it manually, but it was still not working. So, I redid the programming, using the player controller instead. This worked to a degree, meaning it works in the current map, but the total resets when I load the next map in the level. I am sure this is something simple, but I am just not seeing it. Any idea what I am missing?