How do I limit the camera to prevent rapid spinning when aiming down?

This should work for you

task.spawn(function()
	while task.wait() do
		if LockedViewOn then
			local playerPos = LocalPlayer.Character.PrimaryPart.Position
			local cameraPos = LockedViewOn.Position

			local targetCFrame = CFrame.lookAt(cameraPos, playerPos, Vector3.yAxis)
			Camera.CFrame = targetCFrame
		end
	end
end)