"Run On Server" RPCs... doesn't work?

So, issue step-by-step:

1, We have a StaticMeshBP, based on simple SP_CornerFrame static mesh. Yes, it’s marked as replicated ( for movements too ),

3869-1.jpg

2, Next we create very simple behaviour for “E” button. Without some unusual things. And yes in BP we EnableInput for current player and press “E” on client executed successfully.

3885-2.jpg

3, Expecting behaviour: when client press “E” → print message about it on server.

But… nothing.

Trying to do this on native code bring same result. All OK with Server->Client replication. But seems Client->Server call doesn’t work for me.

I’m pretty sure there are simple solution for this problem.

Dave Ratti recently wrote an article on this topic:

Quick quote from the article:

Server RPCs can only be called by a
client who owns the actor executing
the event graph. For example, a
PlayerPawn is owned by the client who
controls it - only that client can
send Server RPCs on that pawn. The
pawn also may own weapons, abilities,
inventory items, etc (this is game
specific). This can be a hard concept
to communicate directly in blueprints.
It is something we will work to
improve as time goes on.

So this may be your issue. In short, you’ll need to call this RPC from an actor that is somehow owned by the PlayerController assigned to your machine. This could be the player pawn that is possessed by this player controller for example.

We’re hoping to have more documentation on these very topics soon, stay tuned :slight_smile:

I have question about this: that is a Blueprint limitation correct? I C++ I can get a pointer to any AActor and call an RPC on that actor even if that code executes on a client that doesn’t own the AActor in question correct?