Event only works once on client.

I’m working on a multiplayer card game, and I’ve gotten the cards to show up on the correct sides, but my test function only works on the client until the server calls it. After the server calls it, the client does not call the function, and I get no errors.

Inside my UMG HUD, button 74 is the button on the bottom of the UI, triggering the following functions.

Inside my Player Controller, the function replicate click event is called from the server, replicating it to all clients. The branch doesn’t do anything right now, it was for debugging.

My player state receiving the click event, and adding the cards to the screen.

Although I’m pretty sure these functions are not where my problem is, here they are as well.

To illustrate my problem, here is a screenshot of my board after triggering the events once on the client, twice on the listen server, then once on the client, where it didn’t work anymore. The client is on the right side, and the listen server is on the left.

The UMG widget for the game ui is created in the hud blueprint that is loaded when the map loads. I can take step-by-step screenshots if needed. Any suggestions?

Cant see screenshots.

They should be working now, thanks.

The core of the issue is that you transfer Player Controller thru Multicast Event.

Since Player Controller is owner only replication, it exist on server and owning client and when multicast event called by listen server, sending Player Controller (exist on server and owner means exist only on server, owner client is server in this case) to all clients, its not valid on any remote client.

Thanks a lot, I ended up moving everything to player state and game state. I also had to make four events, one to recieve the button click, one to run an event on server, one to replicate from the server, and a final one to do the actual work. Is this how it is supposed to be done? It feels a little extensive even if it does make sense.

Yes and no.

It is the way, check locally is the current state for action which player try to do is valid and obey game rules, send action request to server, check again, execute core logic on server, send all clients instructions/result.

But your way of saving “clicked” and then multicasting it for all, check is clicked true is just bad code. Since you doing it in player state, if player controller (owner of player state is always player controller) is valid(remember exist only on server and owner client) on any given client and its “is local player controller” is true(player controller of remote client exist on server, but would return false, because its not local player controller), its means the original action was happen here.