Custom player movement not replicating correctly

I am trying to make custom movement for a multiplayer game via blueprint and it works fine in single-player and as the server, but when I try to move as a client in multiplayer the player constantly gets pushed back to their spawn position. I tried looking on multiple forum posts but couldn’t find a solution.

Example:

How are you setting the movement mode?

I set it to flying with a custom event that replicates on server and client and have it executed at BeginPlay

@nekatsrot - Hard to tell from looking at your video, but I would be willing to bet that your client doesn’t have authority to move the object. Unreal Engine uses network role to determine how much capability each player has over in game objects. The roles you should know are

ROLE_Authority means this instance of the game owns the actor and has final say over its position, state, variables, etc.
ROLE_AutonomousProxy means this instance of the game can update the actor but doesn’t have final say, the authority still has the ability to correct or override.
ROLE_SimulatedProxy means this instance of the game has no control over the actor, it just gets updates from the Authority and represents them in the local game world.

You can verify this by opening the console in the game and using the following command

displayall myactorclass role

You should see a list of all actors of myactorclass and their role. On your server the actor’s role is going to be

ROLE_Authority

On your client it will be either Simulated Proxy or Autonomous proxy. If it’s simulated proxy it means that you don’t have any control over moving that object. So you’re probably moving it locally on your client and then it’s getting corrected by the server because it wasn’t moved by a client with appropriate access.

If you want to move an actor that you don’t have Autonomous Proxy ( or Authority) on you will have to make a server call from an actor which you DO have Autonomous Proxy on (See my post here about RPC’s and the reference).

You should be able to make the call from your PlayerController class on the client… which, by the way, will be ROLE_AutonomousProxy

=P

Good luck

Show the code.

Also, verify Can Fly is ticked in the CMC fly settings. It’s false by default.