Locking and forcing orientation of a part

I have a camera script that also handles character model rotation but whenever the model itself bumps into things, it causes unwanted changes in the orientation. This means the model is forever misaligned from where it should be pointing - the middle of the camera view.

robloxapp-20210817-1923050.wmv (450.7 KB)

This is the code block that handles the camera and player rotation [v]

player.CharacterAdded:Connect(function(character)

	local humanoid = character:WaitForChild("Humanoid")
	local rootPart = character:WaitForChild("HumanoidRootPart")
	humanoid.AutoRotate = false

	local cameraAngleX = 0
	local cameraAngleY = 0

	local function playerInput(actionName, inputState, inputObject)
		if inputState == Enum.UserInputState.Change then
			cameraAngleX = cameraAngleX - inputObject.Delta.X
            -- scale vertical sensitivity to match screen aspect ratio (reminder to make dynamic)
			cameraAngleY = math.clamp(cameraAngleY-inputObject.Delta.Y * 0.5625, -80, 80)
			rootPart.CFrame = rootPart.CFrame * CFrame.Angles(0, math.rad(-inputObject.Delta.X), 0)
		end
	end
	ContextActionService:BindAction("PlayerInput", playerInput, false, Enum.UserInputType.MouseMovement, Enum.UserInputType.Touch)

	RunService.RenderStepped:Connect(function()
		
		local startCFrame = CFrame.new((rootPart.CFrame.Position + Vector3.new(0,3,0))) * CFrame.Angles(0, math.rad(cameraAngleX), 0) * CFrame.Angles(math.rad(cameraAngleY), 0, 0)
		local cameraCFrame = startCFrame:ToWorldSpace(CFrame.new(cameraOffset.X, cameraOffset.Y, cameraOffset.Z))
		local cameraFocus = startCFrame:ToWorldSpace(CFrame.new(cameraOffset.X, cameraOffset.Y, -10000))
		camera.CFrame = CFrame.new(cameraCFrame.Position, cameraFocus.Position)
	end)
end)

I was wondering if there was a way to not only force the Y-Orientation of the root part to match the Camera’s but also disable any rotation on the X and Z axis as well.

I have already tried to force the root part orientation by getting the Y rotation of the camera and applying it to the root part via. Orientation = Vector3.new(0, camY, 0) but to no avail. Any assistance would be greatly appreciated!