Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to sync the cframe with the server and client?

Asked by
TtuNkK 37
4 years ago

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?

1 answer

Log in to vote
2
Answered by
sngnn 274 Moderation Voter
4 years ago
Edited 4 years ago

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.

(Site.)

Note: Use SetNetworkOwner() on the part.

Ad

Answer this question