How would I go about smooth ADS (Aim down sights)

btw this is the code

local function update()
	if game.Players.LocalPlayer.Character:FindFirstChild("Shirt") then
		local TextureVal = game.Players.LocalPlayer.Character:FindFirstChild("Shirt").ShirtTemplate
		script.Parent["Left Arm"].Shirt.Texture = TextureVal
		script.Parent["Right Arm"].Shirt.Texture = TextureVal
		script.Parent["Left Arm"].Color = game.Players.LocalPlayer.Character:WaitForChild("LeftUpperArm").Color
		script.Parent["Right Arm"].Color = game.Players.LocalPlayer.Character:WaitForChild("RightUpperArm").Color
	end
	if script.Parent.Configuration:FindFirstChild("AmmoUI") then
		script.Parent:WaitForChild("Configuration").AmmoUI.Parent = game.Players.LocalPlayer.PlayerGui
	end
	playerUI:WaitForChild("AmmoUI").Ammo.Text = script.Parent.Configuration.Ammo.Value
	if aim == false then
		if game.Players.LocalPlayer.Character:WaitForChild("Humanoid").MoveDirection.Magnitude > 0 then
			t = tick()
			if lastState == 0 then lastState = 1 startTime = tick() end
			-- do math
			local x = math.cos(t * 5) * 0.25
			local y = math.abs(math.sin(t * 5)) * 0.10

			local alpha = (TweenService:GetValue(math.min((tick() - startTime) / TweenTime, 1), Enum.EasingStyle.Cubic, Enum.EasingDirection.Out))
			local cf = CFrame.new(x * alpha * Intensity, y * alpha * Intensity, 0)
			script.Parent.PrimaryPart.CFrame = game.Workspace.CurrentCamera.CFrame * cf
		else
			if lastState == 1 then lastState = 0 startTime = tick() end
			-- do math
			local x = math.cos(t * 5) * 0.25
			local y = math.abs(math.sin(t * 5)) * 0.25

			local alpha = 1- (TweenService:GetValue(math.min((tick() - startTime) / TweenTime, 1), Enum.EasingStyle.Cubic, Enum.EasingDirection.Out))
			local cf = CFrame.new(x * alpha * Intensity, y * alpha * Intensity, 0)
			script.Parent.PrimaryPart.CFrame = game.Workspace.CurrentCamera.CFrame * cf
		end
	else
		local Alpha = game.ReplicatedStorage.AimAlpha 

		function aimIn()
			local AimTween = game:GetService("TweenService"):Create(Alpha, TweenInfo.new(0.5,Enum.EasingStyle.Sine),{Value = 1})
		end
		
		function aimOut()
			local AimTween =  game:GetService("TweenService"):Create(Alpha, TweenInfo.new(0.5,Enum.EasingStyle.Sine),{Value = 0})
		end
		game:GetService("RunService").RenderStepped:Connect(function(dt)
			script.Parent.HumanoidRootPart.CFrame = game.Workspace.CurrentCamera.CFrame 
			script.Parent.Aim.CFrame:Lerp(game.Workspace.CurrentCamera.CFrame,Alpha.Value)
		end)
	end
end