replicate gun server

hi i am trying to replicate the weapon currently the server and the client sees what the server is doing but the server does not see what the client is doing the weapon is not moving into the server view

Hi primillo_vk

The server cannot see what the client is doing. Think of them as separate entities.
You need to forward the inputs from the client to the server to move the gun and then get the updated position to replicat back down to the connected clients.

Hope this helps

Alex

thanks alex for your answer i tried to try to replicate from the controls but it does not follow up on the server of the gun it shows you that it did not catch it staying on the site but i tried to destroy the gun and if it replicates it from client to server and in server.

Hi primillo_vk

I see you keep using “GetAllActorsOfClass” This is an extremely slow function and should be used lightly. If there is too much work on the server, it might not execute your event. You can force this by checking “Reliable” on the event itself.

Also you are passing a reference to the object from the client to the server. The object you are trying to send will be a different instance on the server so check to make sure the “out” reference is valid (the server knows what it is).

Make sure the actor is set to replicate properly.

Good luck

Alex