How would I sync client-sided NPC's with the server's position?

  1. What do you want to achieve?
    Trying to sync the AI from client’s render with the servers position.
  2. What is the issue?
    Cannot fix the AI’s position with the server.
  3. What solutions have you tried so far?
    Tried to fix the client’s render with the AI’s hitbox, but still wouldn’t work when chasing/hunting down the player.

I thought I had found the solution by replicating the render script in replicatedfirst, but It wouldn’t work with the position of the hitbox in the server.
So, the hitbox from the server would go further and leaving the client AI render behind. How would I try to fix an issue like this?

1 Like

It should normally replicate by default, be sure the hitbox is attached through sort of constraint to the NPC’s root and unanchored. If you’re moving the NPC’s before or after initiating pathfinding methods on it, be sure to use :MoveTo() or :PivotTo() instead of hrp.Position, as the latter will not replicate.

Thanks, I tried using MoveTo() for the longest time but it didn’t seem to work so for this situation always use :PivotTo().

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.