I have a plane that uses HingeConstraints to move its flaps up and down, but when I change the angle of the flaps, they don't run smoothly. I believe this is due to the latency between the client and server. If I place the plane in ReplicatedStorage, then move it to workspace, it runs smoothly because its physics are being calculated on the client. But there's a problem with that, as shown in the video below:
Plane placed in Replicated Storage, then moved to Workspace (smooth, then glitch when going fast enough): https://i.gyazo.com/a5cfee8d58807efb74f51e19b224bdce.mp4
Plane placed just in Workspace (smooth, then lag when going fast enough; Lag stays even if you slow down): https://i.gyazo.com/87bfbeef402e6939e1e6ce488f0d26ee.mp4
So I want to know if there are any solutions to this. I'm thinking of just dealing with the lag, or possibly using something other than constraints.
THE SOLUTION: It turns out I needed to change the Network Ownership of the object, as after a certain distance, the physics of the plane would be handed off to the server rather the player; And because I deleted the player's character to replace it with a plane, the character's location was still recognized as (0, 0, 0).
function ChangeNetOwnership(object, owner)
if object:IsA("BasePart") then --Make sure its a part, not a script or something
local canSet,errorReason = object:CanSetNetworkOwnership() --To test if the net ownership can be changed; It can't be changed if its anchored
if canSet then
print(object:GetFullName().."'s Network Ownership can be changed!")
object:SetNetworkOwner(owner)
else
warn("Cannot change the Network Ownership of "..object:GetFullName().." because: "..errorReason)
end
end
for _, child in ipairs(object:GetChildren()) do
ChangeNetOwnership(child, owner) --Recursion loop, used to check if parts are within other parts or models, and to change net ownership of those too
end
end
ChangeNetOwnership(script.Parent, game.Players[script.Parent.Name]) --script.Parent is the model that contains the moving Plane parts that I need to change the ownership of. This script is disabled at first, then activated by a localscript when the plane's parts are ready

1 comment
Thanks, I will give this a try tomorrow when I have time (doing homework now). It sounds like this could work!