How to display score from multiple character blueprints

I’m making a single-player game where you can transform, each character has they’re own character blueprint, and you score by collecting coins. My HUD only shows 0 and doesn’t update at all.

What elements should I call where?

**How should I go about this? Thanks! **

Hi,

where are you storing your score. If you aren’t doing that already, try soring it in the PlayerState. It presists even if you destroy and spawn pawns.

PlayerState

A PlayerState is created for every player on a server (or in a standalone game). PlayerStates are replicated to all clients, and contain network game relevant information about the player, such as playername, score, etc.

The PlayerState can be accessed via the PlayerControllers PlayerState variable.

My character blueprint parent-child setup is like this.

-Main Character

–Type 1

–Type 2

I tried this tutorial but it’s only for a single character blueprint.

video link

Any ideas on how I should go about this? ?

Have you tried as I said in my Answer above? With the playerstate you get a place independent from you characters where you can store your information.

Hi there, this is what I came up with. Still haven’t figured it out :frowning:

Game Mode

Player State

Widget BluePrint

Score Not Appearing

I added PrintString to both PlayerState and my WidgetBlueprint and nothing appears on my play screen

Could you add somthing to the widget that is always drawn even if the values of the score are not available. A progressbar mayme. To make sure the widget is rendered.

Try adding a “PrintString” to the “Cast Failed” in the Playerstate to see if something goes wrong there.

Did you tell the Gamemode to use your Playerstate?

126340-worldsettings_gamemode.jpg

The progress bar works but not the score. The score is supposed to be beside the character’s head.

The PrintString is also displayed from the GameModeBluePrint and LevelBluePrint.

I think I’m close ? ?

Yes I did, but still it doesn’t show up

Try adding a Breakpoint at the “ToText” node in your widget (Select it and press F9). To see if this node is ever reached. Also try to remove the “Cast to Hero_Game” in your player state. You dont need it there.

I checked it and the node is reached, and the score is now displayed! Thanks! !

This is what I came up with to get the widget working.

Score Widget Blueprint

PlayerState Blueprint (AddScore Function comes from here)

Character Blueprint

Game Mode Blueprint

Powerup Blueprint

I still get the score even when the character transforms into a different character (blueprint) which is what I exactly need.

I’m not totally 100% sure why it works now but I got it somehow using your tips and concepts. Thanks a lot