How to do this cam system?

It tilts, camera angle changes based on the input movement, but how?, i’ve got this code from the original game, not made by me ofcourse, But i want to learn how this exactly works, if someone could explain this, it would be greatly appreciated as i want to do a similar one

local l__UserInputService__2 = game:GetService("UserInputService");
local l__components__14 = CFrame.new().components;
local v15 = TweenInfo.new(0.035, Enum.EasingStyle.Quad, Enum.EasingDirection.Out);
local l__Vector3_new__1 = Vector3.new;
local l__math_acos__2 = math.acos;
local l__inverse__3 = CFrame.new().inverse;
local l__CFrame_fromAxisAngle__4 = CFrame.fromAxisAngle;
local l__CFrame_new__5 = CFrame.new;
local l__math_atan__6 = math.atan;
local l__math_atan2__7 = math.atan2;
local u11 = 0.25;

local function u9(c, v, t)
	local c=c-c.p
	local rv=(l__inverse__3(c)*v).unit
	local rz=rv.z
	return rz*rz<0.99999 and c*l__CFrame_fromAxisAngle__4(l__Vector3_new__1(rv.y,-rv.x,0),l__math_acos__2(-rz)*(t or 1)) or c
end;
local function u10(l)
	local z=l.z
	return l__math_atan2__7(l.y,-z),-l__math_atan2__7(l.x,-z)
end;  

local mouse = l__LocalPlayer__5:GetMouse();

l__UserInputService__2.InputChanged:connect(function(p6)
	if p6.UserInputType == Enum.UserInputType.MouseMovement then
		local v27 = p6.Delta.x * 0.005;
		local v28 = p6.Delta.y * 0.005;
		local v29 = v27 * v27 + v28 * v28;
		if v29 > 0 then
			u8 = (u9(l__HumanoidRootPart__10.CFrame, u8) * l__CFrame_fromAxisAngle__4(l__Vector3_new__1(-v28, -v27, 0), v29 ^ 0.5)).lookVector;
		end;
		local v30 = l__HumanoidRootPart__10.CFrame - l__HumanoidRootPart__10.Position;
		local v31 = v30:inverse() * u8;
		local v32, v33 = u10(v31);
		if v32 < -1.4391666666666667 then
			local l__y__34 = v31.y;
			local l__z__35 = v31.z;
			local v36 = math.cos(-1.4391666666666667 - v32);
			local v37 = -math.sin(-1.4391666666666667 - v32);
			local v38 = l__z__35 * v36 - l__y__34 * v37;
			local v39 = l__z__35 * v37 + l__y__34 * v36;
			u8 = v30 * l__Vector3_new__1(v31.x < 0 and -(1 - v39 * v39 - v38 * v38) ^ 0.5 or (1 - v39 * v39 - v38 * v38) ^ 0.5, v39, v38);
			return;
		end;
		if v32 > 1.4391666666666667 then
			local l__y__40 = v31.y;
			local l__z__41 = v31.z;
			local v42 = math.cos(1.4391666666666667 - v32);
			local v43 = -math.sin(1.4391666666666667 - v32);
			local v44 = l__z__41 * v42 - l__y__40 * v43;
			local v45 = l__z__41 * v43 + l__y__40 * v42;
			u8 = v30 * l__Vector3_new__1(v31.x < 0 and -(1 - v45 * v45 - v44 * v44) ^ 0.5 or (1 - v45 * v45 - v44 * v44) ^ 0.5, v45, v44);
		end;
	end;
end);

local u20 = 1.0471966666666666;
local u21 = 0;
local function u22(l)
	local x,z=l.x,l.z
	return l__math_atan__6(l.y/(x*x+z*z)^0.5),-l__math_atan2__7(x,-z)
end;
local u23 = nil;
local function u24(p9, p10, p11)
	local l__unit__61 = p9.unit;
	local l__z__62 = l__unit__61.z;
	local v63 
	if l__z__62 * l__z__62 < 0.99999 then
		v63 = l__CFrame_fromAxisAngle__4(l__Vector3_new__1(l__unit__61.y, -l__unit__61.x, 0), l__math_acos__2(-l__z__62) * (p10 and 1)) or l__CFrame_new__5();
	else
		v63 = l__CFrame_new__5();
	end;
	return v63;
	
end;
local function u25(c, v, t)
	local rv=(l__inverse__3(c)*v).unit
	local rz=rv.z
	return rz*rz<0.99999 and c*l__CFrame_fromAxisAngle__4(l__Vector3_new__1(rv.y,-rv.x,0),l__math_acos__2(-rz)*(t or 1)) or c
end;

l__RunService__3.RenderStepped:Connect(function()
	l__Humanoid__7.CameraOffset = Vector3.new(0, 0, 0);
				workspace.CurrentCamera.CameraSubject = v6;
				l__CurrentCamera__4.CameraType = "Scriptable";
				if _G.CameraMode == "LockFirstPerson" then
					l__UserInputService__2.MouseBehavior = Enum.MouseBehavior.LockCenter;
				else
					l__UserInputService__2.MouseBehavior = Enum.MouseBehavior.Default;
				end;
l__CurrentCamera__4.CameraType = "Scriptable";
				local l__x__80 = u8.x;
				local l__z__81 = u8.z;
				local l__x__82 = l__HumanoidRootPart__10.Velocity.x;
				local l__z__83 = l__HumanoidRootPart__10.Velocity.z;
				if l__x__82 * l__x__82 + l__z__83 * l__z__83 > 4 and l__x__80 * l__x__82 + l__z__81 * l__z__83 < -0.5 * (l__x__80 * l__x__80 + l__z__81 * l__z__81) ^ 0.5 * (l__x__82 * l__x__82 + l__z__83 * l__z__83) ^ 0.5 then
					u20 = math.min(u20 * 0.9, math.abs(u21 * 0.9));
				else
					u20 = u20 * 0.1 + 0.9424769999999999;
				end;
				local v84, v85 = u22((l__HumanoidRootPart__10.CFrame - l__HumanoidRootPart__10.Position):inverse() * u8);
				if u20 < v85 then
					l__HumanoidRootPart__10.CFrame = l__HumanoidRootPart__10.CFrame * CFrame.Angles(0, v85 - u20, 0);
				elseif v85 < -u20 then
					l__HumanoidRootPart__10.CFrame = l__HumanoidRootPart__10.CFrame * CFrame.Angles(0, v85 + u20, 0);
				end;
				local v86, v87 = u22((l__HumanoidRootPart__10.CFrame - l__HumanoidRootPart__10.Position):inverse() * u8);
				u23 = v86;
				u21 = v87;
	
			-- l__RemoteEvent__13:FireServer(u24((l__HumanoidRootPart__10.CFrame - l__HumanoidRootPart__10.Position):inverse() * u8, 0.75), (u24((l__HumanoidRootPart__10.CFrame - l__HumanoidRootPart__10.Position):inverse() * u8, 0.75)));
				local v88 = u25(l__Head__8.CFrame * l__CFrame_new__5(0, 1, 0), l__Head__8.CFrame * l__Vector3_new__1(0, 1, 0) + u8) * CFrame.new(0, -0.5, 0);
				l__TweenService__1:Create(l__CurrentCamera__4, v15, {
					CoordinateFrame = v88 * CFrame.new(0, 0, u11)
				}):Play();
end)

how it should look :