Character Controller API Replication Discrepancy

I ran into this issue when creating a custom NPC system with server-sided movement and client-sided rendering. On the server, I created a custom NPC by using the Character Controller API. Once a client joins the game, they clone and render a client sided humanoid NPC over the server-sided movement NPC by using a weld. However, when I adjust the position of this client NPC, it shifts over the server-sided NPC for that client only and continues pathing in an offset pattern relative to the server’s view.

Here’s videos that demonstrates my issue:


The rendered client NPC (the zombie model) has the humanoid’s EvaluateStateMachine property false and the humanoid state was changed to Physics by using the ChangeState method. The client rig also has every part listed as massless, can-collide false, and anchored false. The server sided NPC has it’s network ownership set to the server.

The issue appears to stems with the welding of the client NPC to the server NPC. Testing it with WeldConstraints versus Weld objects yielded the same result.

Expected behavior

I expected the Character Controller objects to “auto-correct” the discrepancy of the NPC’s positions. Humanoids already perform this feature, so I expected there to be parity between the two systems (Character Controllers and Humanoids).

This is what happens if I change the position of a server sided NPC from the client. You can see how offsetting the server NPC (which has network ownership set to the server) corrects the position. This is what I expected:

The current work around I’m doing to reach the expected behavior is to just CFrame the client sided NPC to the server sided NPC’s position every frame using RunService. This works, but now I need to worry about CFrame’ing the client sided NPC every frame; This can be taxing for larger amount amounts of NPCs, as generally Roblox’s in-built physics are faster and more optimized than CFrame’ing.

A private message is associated with this bug report

2 Likes

If anyone else wants the test case files, take a look here!

We’ve filed a ticket into our internal database for this issue and will start investigating, we will update you when we have further information.

Thanks for flagging!