Trouble with getting Replication to work

Hi there!

I am trying to implement multiplayer into a VR project I had made previously, but I am running into some issues with setting up the replication.
I have set up a listen-server to which other clients can connect. This works fine.
Players can pick up items, and when they release them I would like to send the new location to the other clients. As I understand it, the controlling Pawn should send a message to the server, which then notifies all clients.

However, after some testing it looks like the client Pawn never actually sends anything to the server. This is the code I have so far, all in a custom PlayerPawn class:

The function declaration:

And the function call and implementation:

When these functions are called on the server-Pawn, it runs fine and the Actor is updated for the other client as expected. When called from the other client, the debug messages do not appear, and the Actor is not updated. If I leave out the check for ROLE_Authority, the messages are displayed, but the Actor is not updated on the listen-server. I would assume this indicates the function is executed locally, and not on the server.

Am I missing something obvious that prevents the client from asking the server to execute the function?

I realize keeping track of an Actor position would be better with replicated variables, but there I run into the same issue that the client is not talking to the server.

Any help on this would be greatly appreciated! :slight_smile:

IIRC, debug messages are displayed by default on the server, and not on the pawn.
There is an option to avoid that.

Using the blueprint version of debug add a [Server]/[Client X] prefix to debug message who help to understand what is what.

By looking your code everything look right.
Just ensure in the .h replicated function are UFUNCTION(Server, reliable) etc etc…

Thank you for the quick reply!
I have done some additional testing, and the client and server do in fact communicate with each other. I did a quick setup in blueprint, as seen below:

This works as expected, with the server getting both messages and the client receiving only the latter. Unless I am missing something, this is the exact same setup as I have in C++, as found in the first post.

When disabling the check for ROLE_Authority and calling the function on the client, both debug messages are displayed on the client. This means that it is not sent to the server over the network. However, the function declaration with UFUNCTION(Server, Reliable) should make sure that it is sent to the server, right? Or am I missing something else?

Well I found out what my problem was. In the cpp there was a call directly to the ServerRPCUpdateItemLocation_Implementation(), instead of the base function. Simply changing this to ServerRPCUpdateItemLocation() solved the problem.