Smooth First Person Camera

I’m trying to create a first person smooth camera like that of Doors, (besides seeing your body). I’ve been avoiding setting the camera type to “scriptable” because it would break other systems in my game. I’ve looked at lots of other posts about this topic but haven’t found anything that does what I want to achieve without setting the camera to “scriptable”
So far, I have this:

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")

local localPlayer = Players.LocalPlayer
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid"):: Humanoid
local HRP = character:WaitForChild("HumanoidRootPart"):: Part

local camera = workspace.CurrentCamera

local clamp = math.clamp

local targetX, targetY = 0, 0

local MAX_ANGLE = 80
local MIN_ANGLE = 90

local SPEED = 2
local SENSITIVITY = .8
local RELEASE_DECEL = .5

UIS.MouseDeltaSensitivity = 0.01

RunService.RenderStepped:Connect(function()
	local x, y, z = camera.CFrame:ToOrientation()
	
	local delta = UIS:GetMouseDelta()
	
	if clamp(y, -MIN_ANGLE, MAX_ANGLE) == y then
		targetX += delta.X
	end
	
	targetY += delta.Y
	
	targetX *= RELEASE_DECEL
	targetY *= RELEASE_DECEL
	
	camera.CFrame *= CFrame.fromOrientation(-targetY * SENSITIVITY, -targetX * SENSITIVITY, 0)
end)

It works, but can be jittery and unstable sometimes, and I don’t know how to fix it. I’m fine with rewriting it as long as it achieves an effect like Doors without being this unstable.

In order to create a custom “Smooth First Person Camera” you need to set the CameraType to Scriptable otherwise Roblox’s default CameraModule will still be controlling the camera.

What other systems in your game would break if the CameraType was set to Scriptable?

Mainly the Camera Shake module, this is a Core Game, (game where big facility go boom) and Camera Shake is a big part of making those kinds of games immersive and intense.

Also, you can still manipulate the camera when it’s not set to “scriptable”, it’s just that the default camera controller will also be manipulating it. If you run my code, you can see that it works, it’s just unstable sometimes.

Prior to this attempt, I had tried using “scriptable” as well as a spring module to make it smooth, but I couldn’t get it to work.