Need help with starfighter rotation script

Greetings developers,

I’m looking for some help with turning a starfighter relative to the mouse position. (The more the mouse is away from the centre, the more it turns.)
Right now it just moves the starfighter to 0, 0, 0 with no rotation.
This is what I have in a LocalScript parented to a Gui that follows the mouse:

game["Run Service"].Heartbeat:Connect(function()
	wait(0.1)
	if inSeat then
		game.ReplicatedStorage.RemoteEvents.StarfighterMouse:FireServer({tonumber(string.split(tostring(script.Parent.Position.X), ", ")[2]), tonumber(string.split(tostring(script.Parent.Position.Y), ", ")[2])}, {game.Players.LocalPlayer:GetMouse().ViewSizeX, game.Players.LocalPlayer:GetMouse().ViewSizeY})
	end
end)

And I have this in a ServerScript parented to the starfighter:

game.ReplicatedStorage.RemoteEvents.StarfighterMouse.OnServerEvent:Connect(function(plr, mousePos, screenSize)
	if script.Parent.StarfighterSeat.Occupant ~= nil then
		if script.Parent.StarfighterSeat.Occupant.Parent.Name == plr.Name then
			game.TweenService:Create(script.Parent.TweenValue, TweenInfo.new(0.1), {Value = CFrame.new(script.Parent:GetPrimaryPartCFrame().Position) * CFrame.Angles(
				(math.rad((script.Parent:GetPrimaryPartCFrame().Rotation.X * mousePos[1] - (screenSize[1] / 2))) / 10),
				(math.rad((script.Parent:GetPrimaryPartCFrame().Rotation.Y * mousePos[2] - (screenSize[2] / 2))) / 10),
				0
				)})
			script.Parent:SetPrimaryPartCFrame(script.Parent.TweenValue.Value)
		end
	end
end)

Any help is appreciated.

The way you make it work is not very good.
You should obtain the difference in direction between the camera and the ray from the camera to the mouse, then you send it to the server.
You compare this direction with the direction of the plane on the server and the server makes an algorithm to calculate the rotation to make.

Also, you will want an dead zone to prevent the mouse from being too active. You may want to make the mouse return to the center, like in an FPS game. Using UserInutService.InputChanged will be a good idea. When you move your mouse, you can add the movement value to a data which is constantly being lerped back to the center of the screen.

One final thing, NEVER USE WAIT in any runservice items. The run service is ran based on frames and waiting will make things behave bad when your players are using a better FPS.