Replicating Text

I’ve run into some trouble with replicating text over a network.

I’m using a widget to place a characters name above their mesh, and the text variable is set to replicate.

On the player controller, I have a string called player name, which is set to repnotify. When this string changes, the notify casts to the user widget, and sets the text based on the player name variable.

The problem I’m running into is that both characters will inevitable be named the same thing. For example, if I change the playername on client 1, the text updates accordingly. Unfortunately, client 2, on their end, is also named the same thing. Player 1 and Player 2’s names change, but only on their screen.

Has anyone run into this? Does anyone know how I can get around this?

In your OnRepPlayerName function you are called GetPlayerCharacter(0), which returns the character being controlled by the local player on each client, setting the name on the wrong character.

I used both yours and SenToRious’s comments, they were spot on. thanks!

I used both yours and Manoel.Neto’s comments, they were spot on. thanks!

Don’t use Get player character, instead use Get controlled pawn in your player controller.