I’m working on a script to move an NPC ship, which is based on a root part. All other parts are welded and massless. The client performs as expected, smoothly turning the root when the A and D keys are pressed. The server, using the exact same root, exact same module function, and given network ownership, does not.
No matter the angle, the root does not turn for the server. Just as the client does, the server changes the properties of the AlignOrientation. However, it does not turn, no matter what. Using an AlignPosition in the same module function, the ship can move smoothly forward on server or client, proving that it is not a higher issue, it is directly related to the AlignOrientation.
Following is the relevant code from the loop, part of the module function which is called each frame:
local yPerFrame = (stat.Agility.Value * 10) * delta * 100 -- the 100 is to ensure that the cause isnt too small a degree, but the client works just fine without the 100, and it doenst fix the server local turn = 0 if aDown then turn = turn + yPerFrame end if dDown then turn = turn - yPerFrame end print("Y change this frame is", math.round(turn * 1000) / 1000) -- this value does change as it should, and is the same as the client root.TurnForce.Enabled = true root.TurnForce.CFrame = CFrame.new(root.Position) * CFrame.fromEulerAnglesXYZ(0, math.rad(root.Orientation.Y + turn), 0) local x, y, z = root.TurnForce.CFrame:ToOrientation() local orient = Vector3.new(math.deg(x), math.deg(y), math.deg(z)) print("TURN ORIENT IS", orient) -- changes as it should, the root's current angle plus the y change this frame
I’ve been trying to fix this for days, please help.