local RunService = game:GetService("RunService")
local input = game:GetService("UserInputService")
local ship = workspace.Ship
local dir = 0
local zRot = 0

function ControlShip()
	
	...
	...
	
	input.InputChanged:connect(function(k)
	    local key = k.KeyCode
		if input:IsKeyDown(Enum.KeyCode.A) then
	       	dir = 1
			zRot = -20
	    elseif input:IsKeyDown(Enum.KeyCode.D) then
			dir = -1
			zRot = 20
		end	
	end)
	
	input.InputEnded:connect(function(k)
	    local key = k.KeyCode
	    if key == Enum.KeyCode.A or key == Enum.KeyCode.D then
	       	dir = 0
			zRot = 0
	    end
	end)
	
	ship.Velocity = Vector3.new(25 * dir, 0, 75)
	ship.Orientation = Vector3.new(ship.Orientation.X, ship.Orientation.Y, zRot)

end

RunService:BindToRenderStep("Control Ship", Enum.RenderPriority.First.Value, ControlShip)

The ship is an unanchored MeshPart. Its CollisionFidelity is set to Hull. When the game runs without any user input, things are nice and smooth - there are no problems. However, as soon as the player presses A or D, the game slows horribly slow. (other keys do not trigger the lag)

Here's what I've tried so far:

  1. Setting the Part to be anchored and modifying the script to changing Position every frame rather than Velocity. The problem with this is that the ship will not collide with the other parts, which is a fundamental game mechanic.

  2. Commenting out the dir = # and zRot = # meaning that when the player presses A or D, seemingly nothing happens. In this state, there is no performance issue.

  3. Adding wait() in just about every conceivable place. This changes nothing on the performance end.

  4. Changing the RunService Events, changing the priorities of the Event, and changing it to Heartbeat, and just running the ControlShip function on a while wait() do timer. Nothing fixes the issue I'm having.

This means I've (hopefully) narrowed it down to a problem with part Velocity or Orientation updating every frame. I've been stuck on this issue for roughly 6-7 hours now and I'm out of ideas. Any help in resolving this problem would be greatly appreciated, because I can't figure it out!

The game runs perfectly fine in Studio for at least 45 minutes straight, but on a live server, the ship's position is rubber-banded and the game slows down drastically.

GIF of game in Studio

GIF of Live Game

Thanks for your time! :)