RPC RunOnServer calling from Client, not working

Hi there…

I´m currently struggling with this problem, where I can´t call an Event with RunonServer as Replicating set, via a Client Event.

All I found in Google were scenarios, where the RPC Server event is in another Blueprint.
But… my Scenario is as follows:

PlayerController has the client event but also the server event. Both Events are in the same PlayerController.

The Client event is for toggling on and off HUD elements (Widgets), and then calls the Server Event to set Variables for allowing Movement, Interactions…etc. and focusing the current Widget.

This works fine for the Host Player… but not for the Client…

Here is an image of the Server Event, and the Client Event that it needs to call, to setup the Focus and InputMode:

The Event “Server_SetPlayerOptions” is called from a simple Input trigger, that first toggles the menu, and then calls this Event.


The Function in the Event call is this:

“Client_ToggleGameMenu” just switches the GameMenu on and off, in regard to its visibility state.
And then calls this (as an example):

All of that, is inside the PlayerController.

As said… the Host can call this without any problems… But the joined player can´t call that…

Would be nice if someone can help me out here…

If you have a Host and 1 connected Client then that Client has 1 instance of a PlayerController (its own only) and the Host has 2 instances of a PlayerController namely its own and Client 1.

What it looks like you are trying to do is use the reference to a widget created on the server and sending it to the client using an RPC. This won’t work since widgets are not replicated. Widgets gets created locally so the instance created on the server is meaningless to the instance created on the client.

When a replicated Actor is spawned by the server then the client is instructed to spawn the Actor and the reference is synchronized.

When a Widget or non-replicated Actor is spawned either by the Server or Client then the reference is not synchronized.

Avoid sending widget references through RPC’s and instead send the variables only and update the local widget using those variables.

Thanks… helped me out :smiley:

1 Like