Problem with Replication from Client to Server

Hey All,

I am still expanding my knowledge into UE4 C++ programming but I have run into an issue that I have yet to figure out. In my prototype multiplayer game I have an actor that’s a sword. The character running on the server can walk over and equip the sword and all the clients see this happen, but when a client equips a sword only that client can see the character holding the sword. The server and other clients still see the sword on the table.

Instead of posting code and getting the problem solved can anyone point me in the right direction? I am guessing its a replication issue somewhere. I have watched several videos and read documents where the replication is not working on the server or the client but then they fix the problem, but I cannot find the link I am missing which is keeping the information from the client to go back to the server and update.

Thanks for any direction you all could point me in!!

still the best description I have found

For your case it’s sounds like the pickup logic is executed on the client on not on the server for the clients.
I would guess you need a client to server RPC for the pickup.

RPC invoked from a Client…60

Thank you Lardo. I will check it out

Lardo is correct.

The server works because it can directly execute the Multicast RPC and everybody will see it.
However, if a client executes a Multicast RPC, no one except the client will see it. Multicast must be executed on the server for it to be multicast to all.

Therefore, the client must first execute a “Run on Server” RPC, telling the server that it wants to pick up a sword. The server then gets this and then executes a “Multicast” RPC, so that it tells everyone that this client picked up a sword. This way, the event will be seen by everyone. While executing the “Run on Server” RPC, you can add additional code to make sure that the sword is there, and it has not been picked up by another client at the same time.

Replication to other clients only works through the Server. You cannot communicate something to another client directly, unless you’re the Server.

I hope this has been clear enough! Let me know how it goes!