How To Pull Data From PlayerState to HUD (Online Match)

I am trying to implement a score system in Blueprints through the PlayerState. I am having trouble getting the playerscore to display in the players HUD when in a online Session.

I have this code in the player state

which then runs this code to update the text.

The person Host/Server works fine, but the Client doesn’t ever update the HUD text. I am asking the player controller to find the player state, does the player controller order vary for each player or is it the same? Meaning, is the client considered player controller 0 or do they get issued order number 1 when network replicated?

use OnRep instead of RPCs for this,
also the HUD could just bind directly to the playerstate instead of going through pawn unless you have a reason to do so

So if I ever want to pull something from the player state I need to figure out how to get the PlayerState blueprints to do an OnRep event to trigger something in a different blueprint? That sounds like that will make your blueprints complicated real fast.

And to answer your question, I am choosing not to have a bind event because bind events are called every tick whether there is new information or not being sent is my understanding based on videos I saw. I am trying to avoid tick events being called like that, especially for multiplayer purposes.

by bind i meant bind to an event dispatcher,

getting the playerstate is easy, every widget knows its owning player, and every player knows its playerstate.

OnRep is much more efficient and reliable than RPCs

I am not fully understanding how you would go about creating and connecting the event dispatcher the way you describe. They way I had it sounded easier for some reason, that would be why I didn’t think about it.

thats ok, any way is fine really, the key point was to use OnRep, when it replicates the variable itll call the OnRep function on the client and inside that you can update the widget any way you choose.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.