Problem to casting in multiplayer

So i am working on multiplayer game using Steam and i have encountered an issue with casting my HUD. The servers hud is fine, but the casting in clients HUD always fails and i can’t get things like respawn widget to show .


Thanks for the help.

Hi,

HUDS and Widgets only exist on the clients, so server can’t get any info from them. Try to use a replicated class to communicate with your widgets like your PlayerController.

So if server cant get info from client widget then how should i fix my problem? This function has 2 inputs, both are of controller reference and the widget that is created has 1 button and when you press the button respawn dispatcher is called. All of this is working, but only when the client kills the server and not the other way around.

Hi,

I wouldn’t do this in the GameMode as that is Server only.

I would keep a reference to my HUD in the PlayerController and store every data there that my HUD would ever need.
The PlayerController can be utilizied as a communication channel between your HUD and the Server, as it is owned by the Client, but exist on the Server as well.

The main idea is to mirror your data to your HUD, do not try to directly store it there, as you will be in trouble if anyone else that the HUD owning client needs the info.

I hope this helps.

Thanks for the help, i dont know if i got it right, but now the death widget show on lient and server, but when i press the button to respawn in death widget client still does nothing. I include 2 screenshots first is gamemode and second is player controller. HUD.png HUD.png

Could you please upload some higher resolution screenshots, as I literally cannot read what the nodes say?

Thanks!

Right now ‘Call Respawn’ executes on the owning client, so the server has no knowledge of it. OnButtonClicked event should call an RPC that executes on the server, and that should execute ‘CallRespawn’

Really thanks for the help, everything works now just need to fix some bugs.