Creating widgets for Players in Multiplayer

Hey everyone !

I am struggling with something for a couple days now. I tried my best to learn the basics of multiplayer scripting and replication in UE4, but somehow I can’t get this simple thing working.
I already managed to spawn 4 Players on PostLogin in my GameMode. Now what I want is that every player gets his own HUD widget when spawning. The first tricky thing is, only 3 players in my game are regular First/Third Person pawns, the last player is a “Director” who has a top down view and different controls. The 3 Players should get the same type of HUD, but the director needs a different HUD.

Screenshots:

You can ignore the “SetHUD” function, I disconnected it since it’s not working.

As you can see, the players spawn as they should, but no matter how I try to create my HUD widget, either only the Server has both widget types, or every player has every widget on top of each other.

I tried creating the widget in the player controller with replication set to “owing client only” but that didn’t work. I don’t know if I’m missing something. To my understanding, creating the widget from the clients player controller should make the widget only visible to the client.

I hope someone can help

Thank you!

Use the “Add to viewport” node

Thats not really my problem, I know how to create and add widgets regulary and this is not working for me in multiplayer.

2 Likes

I did mine in the player character class with the Is Locally Controlled function before the widget creation. That seemed to work. However, for tidiness’s sake, I may need to move it into the player controller class.

Your ‘pawn’ has three types: server, director, and others.
Interface creation is differentiated based on the different types of ‘pawn’ .
So, the function for creating interfaces should be placed in ‘pawn’ and put in ‘event on possessed’.
Select the pawn type when entering the game.