Setting CFrame repeatly on client producing choppy movement on server

Setting CFrame repeatly on client producing choppy movement on server. So basically in our game, we give players the option to lock onto other players to make fighting easier. We do this by binding the following function to the renderstep:

local pos = proxy:getController():getLockedTarget():GetPrimaryPartCFrame().Position
            local lookAt = Vector3.new(pos.X, game.Players.LocalPlayer.Character:GetPrimaryPartCFrame().Position.Y, pos.Z)
            game.Players.LocalPlayer.Character:SetPrimaryPartCFrame(game.Players.LocalPlayer.Character:GetPrimaryPartCFrame():Lerp(CFrame.new(position, lookAt), 0.6))

This is bound using the following function:

runService:BindToRenderStep("Character", Enum.RenderPriority.Character.Value, characterFunc)

Where characterFunc contains the code above. The movement is very smooth on the client, however it is very choppy when observing other players locked on. We would have given up on it by now, but other games like Right 2 Fight have smooth lock on on the client and server end, so we know its possible. We have tried a bunch of different stuff to try to solve this but we have run out of ideas, so we are here for help. Video below of issue.

This is choppy because it’s still relying on automatic physics replications client to server to client which isn’t as fast as render stepped.

So just do it all locally,

  1. Client locks on locally

  2. Client sends lock on target to server

  3. Server sends lock on target to everyone else

  4. Each client does the lock on step 1 for that specific client

1 Like

Try binding to Stepped (physics) instead of RenderStepped (rendering).
The difference is that Stepped runs a little bit earlier, potentially before anything else the client would do with physics (e.g. replicating them).

Failing that, do as dthecoolest above suggests and fake it locally on every client.

1 Like