Lerping a number / angle does full when turning negative

Trying to make character movement like source and ran into a problem.

local rs = game:GetService("RunService")
local goalY = 0
local myY = 0
local neckC0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
local char = script.Parent

function lerp(start, goal, alpha)
	return start + (goal - start) * alpha
end

function getRootRot(char, dt)
	local x, y, z = workspace.CurrentCamera.CFrame:ToOrientation()
	
	return y
end

rs.RenderStepped:Connect(function(dt)
	local cx, cy, cz = workspace.CurrentCamera.CFrame:ToOrientation()
	local rx, ry, rz = char.HumanoidRootPart.CFrame:ToOrientation()
	
	char.Humanoid.AutoRotate = false

	cx = math.deg(cx)
	cy = math.deg(cy)
	cz = math.deg(cz)

	rx = math.deg(rx)
	ry = math.deg(ry)
	rz = math.deg(rz)

	if math.abs(cy - ry) > 45 or char.Humanoid.MoveDirection ~= Vector3.new(0, 0, 0) then
		goalY = getRootRot()
	end
	
	local alpha = math.min(1/0.15*dt, 1)
	
	myY = lerp(myY, goalY, alpha)
	
	char.Torso.Neck.C0 = neckC0 * CFrame.Angles(0, 0, math.rad(cy - ry)) * CFrame.Angles(-math.rad(cx - rx), 0, 0)
	char.HumanoidRootPart.CFrame = (CFrame.new(char.HumanoidRootPart.CFrame.Position) * CFrame.Angles(0, myY, 0))
end)

Whenever I turn towards a certain direction, the number flips negative and the lerp makes it fully spin.
Does anyone know a good solution to this?