Custom ShiftLock Doesn't Rotate Smoothly (Please Help)

Please help I’ve been trying to solve this for the past few days I’m starting to lose my mind, I posted the same thing on the dev forum but there was no solution here is my previous Post

local ShiftLock = false
local UIS = game:GetService("UserInputService")
local Camera = workspace.CurrentCamera
local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()



UIS.InputBegan:Connect(function(Key)
	if Key.KeyCode == Enum.KeyCode.E then
		ShiftLock = not ShiftLock
	end
end)

local Runservice = game:GetService("RunService")

Runservice.RenderStepped:Connect(function()
	if not ShiftLock then return end
	local Character = plr.Character
	if not Character then return end
	local HRP = Character:FindFirstChild("HumanoidRootPart")
	if not HRP then return end
	local CX, CY, CZ = Camera.CFrame:ToOrientation()
	HRP.CFrame = CFrame.new(HRP.CFrame.p) * CFrame.fromOrientation(0, CY, 0)
	Character.Humanoid.CameraOffset = Vector3.new(1.75, 0, 0)
	UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
end)

Problem:

try tweening it i dont know (just dont use customshiftlock thingy or camera things)

CFrame:ToOrientation gets an estimate, not the exact orientation of the part. That might be the reason it’s not smooth.

Maybe using the x and z values of the look vector in the camera and assigning it to the hrp? I haven’t tried it but I have a hunch it could work.

one of my version was just make the character follow the mouse.

can you explain how that works?