Do a function on the server from a client

No worries here it is!

First of all you need to remember that replication ONLY happens from server to client.

The ball I assume you have set to “Replicates” and “Replicate movement”, then you have to apply the force server-side and the “Replicate movement” takes care of replicating the movement to the clients.

In order for a client to send a RPC to the server (“Run On Server” Event) the client needs to own the actor it is sending from. It could be the PlayerController or Pawn.

In this example I am Using the PlayerController.


The Reason that there is 2 RPC’s (SERVER_PushBegin and SERVER_PushEnd) is because you never want to spam RPC’s over the network but only the required ones when something changes.

2 Likes