Client to server replication in blueprints

Hello everyone,

I’ve been banging my head against this problem for a few hours–trying to get the client to affect change on the server in multiplayer. My biggest issue stems from being unable to call RPC functions on an actor (client telling server to run a function) because the client does not own the actor. I’ve seen this problem discussed a lot on this site, but have not found a single solution to the issue.

In short, does anyone know how I can have a client call an RPC function for the server on an actor it doesn’t own?

Thanks.

Client can only call RPCs on actors it owns. It is a security measure, preventing clients from commanding other clients’ actors. Initially, client only owns its PlayerController. You can then establish (on server) ownership chains like:

A pawn owns its weapon, PlayerController owns pawn. Thus, PlayerController will own a weapon and will be able to call Weapon::Fire().

Ah! Thanks for the clarification. Maybe you can help me figure out a better solution to my current case then. I have a server and a client which both display a game board. When either player clicks on a tile on the board, I want it to change color for both players. It’s been easy to make it so that the server’s clicks change the color on the client, but it’s almost impossible for me to think of a way the client can make changes which reflect on the server’s colors as well, since the server “owns” the actor tiles.

Suggestions would be greatly appreciated!

I think I’ve found the proper way to do this: funnel all RPC requests through the client’s PlayerController, which they do own.

Workaround is easy: create Run On Server function in a Player Controller and then from within that function call the function on object that you “don’t own”.