Wallrun tilt keeps glitching

i have this wallrun script that tilts the camera based on the side the wallrun is happening but for some reason the glitches when the tilting is over

code:

local tiltAngle = 15
local currentTilt = 0
local targetTilt = 0

runService.RenderStepped:Connect(function()
	
	local raycastParams = RaycastParams.new()
	raycastParams.FilterDescendantsInstances = filter
	raycastParams.FilterType = Enum.RaycastFilterType.Include
	raycastParams.IgnoreWater = true
	
	local origin = root.Position
	local Rdirection = root.CFrame.RightVector * 3
	local Ldirection = root.CFrame.RightVector * -3
	
	local Rdistanceray = workspace:Raycast(origin,Rdirection, raycastParams)
	local Ldistanceray = workspace:Raycast(origin,Ldirection, raycastParams)
	
	targetTilt = 0
	
	if Ldistanceray and not Rdistanceray and landed == false and climbing == false and holdingSpace == true and torso.Velocity.Y > -40 and torso.Velocity.Y < -1 then
		targetTilt = -tiltAngle
		--wallrun Left
	elseif not Ldistanceray and Rdistanceray and landed == false and climbing == false and holdingSpace == true and torso.Velocity.Y > -40 and torso.Velocity.Y < -1 then
		targetTilt = tiltAngle
		--wallrun Right
	elseif Ldistanceray and Rdistanceray and landed == false and climbing == false and holdingSpace == true and torso.Velocity.Y > -40 and torso.Velocity.Y < -1 then
		--wallrun on both sides
	elseif (landed == true or holdingSpace == false) or (not Ldistanceray and not Rdistanceray) or (torso.Velocity.Y < -35 and torso.Velocity.Y < -1)  then
		--Stops wallrun
	end
	
	currentTilt = currentTilt + (targetTilt - currentTilt) * 0.1
	local camCF = CFrame.new(camera.CFrame.Position, camera.CFrame.Position + camera.CFrame.LookVector)
	camCF = camCF * CFrame.Angles(0, 0, math.rad(currentTilt))
	camera.CFrame = camCF
end)

video of the glitching:

i decided to use the Physics Based Spring Module V2.0 and now the code looks like this:

local smooth = spring.new(20, 10, 540, 0, 0, 0)
local tiltAngle = 1
local targetTilt = 0

runService.RenderStepped:Connect(function()

	local raycastParams = RaycastParams.new()
	raycastParams.FilterDescendantsInstances = filter
	raycastParams.FilterType = Enum.RaycastFilterType.Include
	raycastParams.IgnoreWater = true

	local origin = root.Position
	local Rdirection = root.CFrame.RightVector * 3
	local Ldirection = root.CFrame.RightVector * -3

	local Rdistanceray = workspace:Raycast(origin,Rdirection, raycastParams)
	local Ldistanceray = workspace:Raycast(origin,Ldirection, raycastParams)

	if Ldistanceray and not Rdistanceray and landed == false and climbing == false and holdingSpace == true then
		targetTilt = -tiltAngle
		--wallrun Left
	elseif not Ldistanceray and Rdistanceray and landed == false and climbing == false and holdingSpace == true then
		targetTilt = tiltAngle
		--wallrun Right
	elseif Ldistanceray and Rdistanceray and landed == false and climbing == false and holdingSpace == true then
		--wallrun on both sides
	elseif (landed == true or holdingSpace == false) or (not Ldistanceray and not Rdistanceray) then
		targetTilt = 0
		--Stops wallrun
	end

	local camCF = CFrame.new(camera.CFrame.Position, camera.CFrame.Position + camera.CFrame.LookVector)
	if targetTilt == -tiltAngle then
		smooth:SetGoal(-0.25)
		camCF = camCF * CFrame.Angles(0, 0, smooth.Offset)
	elseif targetTilt == tiltAngle then
		smooth:SetGoal(0.25)
		camCF = camCF * CFrame.Angles(0, 0, smooth.Offset)
	elseif targetTilt == 0 then
		smooth:SetGoal(0)
		camCF = camCF * CFrame.Angles(0, 0, smooth.Offset)
	end
	camera.CFrame = camCF
end)