How to add Custom Player Usernames? / Change Name Nodes - Replication & Multiplayer

Hi, I’ve spent a good while trying to find solutions to this issue, but Epic forums are usually my last resort!

I’m attempting to give players the ability to change their usernames to a custom username. I have 2 main game levels; the Session Create/Join Level and the main Game Level. Its within the session create level where users (and listen server) are prompted to type in a custom username before joining a game from a UI_Widget. The custom username is stored in a GameInstance blueprint within a variable called “PlayerUserName”. Then once the player is teleported to the main game level, the new username is set from inside the GameMode blueprint.

Currently, if both the client and listen server create a username, I can see the custom username printed in game as I’m using a print string to display the text (so it seems to work for both) but for some reason its only the listen servers name that is actually changed/updated in game, the clients name remains as the default name. (worth noting that the listen servers name is only updated when the client joins the game, but Im sure this is because of the way I’m updating the names in the GameMode)

I’m sure I’m missing a simple step, but I’ve scoured the internet and can’t seem to find a working solution. It’s also worth mentioning that I have a Player Struct that contains PlayerName, Kills and Deaths - but again I cant figure out how to alter or update this. With the above attempt, I was avoiding using this Player Structure just because I’m still new to using it. I’ve attached below corresponding screenshots.


If anyone knows a solution or workaround I would hugely appreciate their input thanks!

Last pic…

Event on Post Login provides the Player Controller reference.
Don’t use Get Player Controller. Pipe New Player return to Change Name controller pin.

For On Logout you have to pass Exiting Controller return to the Change Name controller pin.

Take everything from Update Player list GM to the Print String and put it in a Function. Create an input for the Controller.

Post Login → Add → New Function (New Player)
Logout → Remove → New Function (Exiting Controller)

I did try that before, and I’ve tried it again now - but for some reason only the listen server is able to update the ‘player list function’ If the client tries to change its name, nothing happens. I’ve added a print string to the end of the function, and if the client initiates the function - it doesn’t fire. (I’ve also slightly shifted from my earlier approach, and I am now setting the new player name as a variable within my custom player controller, so I’m no longer using the GameInstance class.)

(I’m also a little stuck when passing the exiting controller return to the change name controller pin as you mentioned - slightly confused there…)

On Post login’s controller reference is the one the Game Mode just created for the joining player. It has not touched the actual client (exception is the HOST).

Knowing this you have to have joining clients spawn, then pass save game data to the servers player controller, then to GM. OR have joining clients create names post spawn.

2 Likes

Absolute legend. Can’t thank you enough - spent a good few days on this which could have been done in minutes!

I also had my RPC calls slightly mixed up, which was why the client was unable to talk to the GameMode class.

Really appreciate your help!!

1 Like

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