All PlayerStates' are replicated to Client 1

I have been struggling to replicate a variable that can differ per player. What I’m trying right now is to:

  • Detect server-side when a player collides with a pickup.
  • Remove the pickup and increment the player’s pickup count, which is a replicated integer in my custom player state BP
  • Draw each player’s number of pickups client-side on his HUD

I’m testing with a dedicated server and two clients. This is my collision event handling:

And HUD drawing:

The problem I’m having is that no matter who triggers the collision event, the pickup count is always increased for Client 1 (event if Client 2 triggered the event). I checked that the event is triggered by the right character: if I destroy the triggering actor, it is the correct one that is destroyed. I also made sure that the player state is replicated, and the variable Num Pickups is as well. Can anyone give me some advice on how to get the variable to replicate to the right client? Am I assuming correctly that server-side each player controller’s player state is only replicated to the corresponding client? Thanks.

The only thing I can think of right now is that your Draw HUD is not in the right place or that your VRController is not being properly set (like every Characters VRController is referencing Client 1 instead of the correct client).

Thanks for your reply Cobryis. I’ll test whether server-side VRController references are correct, I hadn’t considered that.

Got the same setup to work in a blank project, I guess someone was off in the template or I messed something up. :slight_smile: