There is always a delay on the server and client, and so when I cframe the humanoidrootpart, it would look like I'm lagging on the screen of the client.
character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.Position - Vector3.new(0,character.HumanoidRootPart.Position.Y,0), hit.Position - Vector3.new(0,hit.Position.Y,0)) * CFrame.new(0, 3.2, 0)
The code above is inside of a server script and is ran when a remote event fires.
How do I make it where the cframe looks smooth on the client-side?
Network ownership is transferred from the server to the client, and the physics are calculated on the client instead. This transfer causes a small delay. There is, however, a way to fix this: SetNetworkOwner()
SetNetworkOwner
is pretty simple to figure out. You set the network owner. Setting it to nil
will actually set the owner to the server, ensuring there is no delay.
Note: Use SetNetworkOwner() on the part.