Character Selection Screen in Multiplayer? Replication to Server

Hello its me again!

Im working on a multiplayer Lobby which lets you choose between multiple characters. You connect via Host/Join into another Level where the Charselection pops up. I have already set up the Character Menu Widget with the basic Movement of a gamepad on player controller (0) and it works on both Client and Server (It Highlights your movement with yellow colour and i have 2 variable ButtonX and ButtonY for movement tracement)

For Example Button1 is in the left corner (ButtonX = 0 ButtonY = 0), Button2 (Buttonx = 1 ButtonY = 0), and so on…

Right now im stuck cause i have no idea how i can replicate those variables from the MenuWidget to the server so both players see the movement of the other one. Is it even possible to use the same widget on server and client or should i totally do that different?

Here are some part of the Blueprints i made:

Character Menu:

Best regards

Can nobody help me?

Why would you want to replicate the entire menu? Menus are usually something that take place locally. I’m not even sure the HUD can be replicated.

If you mean that you want a character picked by one player to become unavailable for any other player (maybe change the button to the player color), you could use a Multicast event to inform all players every time a character becomes (un)available.

I think you first have to send a Run on Server event with the input parameters of the player and the character he picked. And on the server you react to that event with a Multicast event distributing that information back to all clients. Then each client reacts to this Multicast event by marking the button unavailable and, say, changing its color. If you want a client’s own choice to be handled differently than other players’ (maybe you can undo your own choice or the button looks different), you can compare the local PlayerController to the one passed through.

Alternatively, you create a struct to store the character information (such as the button text/icon and which player has picked the character) and store an array of this struct in a replicated variable. In your HUD EventTick you can then loop through this list and color the button depending on the struct information. Obviously whenever one of the players clicks a button you have to send an event to the server to update the list. You’ll probably also want to locally store the client’s chosen character to avoid having to loop over the entire list just to check if a player has already picked something.

That probably doesn’t immediately work, but maybe it gives you an idea of what to try. Good luck!