How To Create Widget On Client?

I’m not sure if I’m doing something wrong here I have a replicated event that executes on owning client when the server presses a button to kick a specific player, it returns the player index and that gets plugged into the get character controller.

It seems to go through considering the kick printstring returns the correct player but it isn’t creating the widget on their screen.

In which class is this event is?

This is in the gamemode

Player Index - is that the player controller id on the server? If so this might be part of the problem, as each machine has their own player controllers with their own player controller IDs.

If you are not doing splitscreen, then each client machine only has one player with player controller ID=0 (though it will be a different number on the server)

Instead put the event on the playercontroller class so when the server calls it on That playercontroller, the playercontroller just does it to itself. It doesn’t have to find the right one.

Just for reference though,
On server all playercontrollers have IDs >= 0 whether remote or local.
On client machines all remote playercontrollers have ID of -1 but all local playercontroller have ids >= 0

The only way i know of to uniquely identify players in a way where the same player on client machine has same number on server is in the playerstate.playerid variable.

But you dont have to do any of that. Just put the event on the playercontroller class and have it create the widget for itself using playercontroller 0 (assuming you are not using splitscreen along with networking)

How do I open the playercontroller class? I can’t seem to find it in the editor.

I created a new playercontroller and I added the event there but how would I trigger the event for that specific controller? I’m not sure how to cast to it since it says it doesn’t derive from playercontroller.

On my list widget that creates a “player info widget” for each player in the server, I get the array index from the player array in the gamestate, that’s the index I use to get the specific players to kick when I press the kick button on their respective info widgets button.

It seems to be able to get the right players from the print string but not create the widget on their screen. It gets the correct playercontroller and character.

When I try to kick myself for debug reasons it creates the widget on my screen, is it a replication problem?

EDITI figured out how to cast to the controller properly and it worked out fine, I didnt realize that the gamemode only exists on the server thank you for the help!

Youre welcome :slight_smile: i struggled with this same thing in my project. Glad I could save you the trouble.