function steadyCamera()scopeSteady.Text="\083\116\101\097\100\121\105\110\103\046\046\046"scopeSteady.TextColor3=Color3.new(1,1,0)camSteady=true local R=camSway local l=2.5 local a=0 while true do RS.RenderStepped:wait()local M=a+l a=M>90 and 90 or M if not steadyKeyPressed then break end camSway=numLerp(R,0,Sine(a))if a==90 then break end end while steadyKeyPressed and Aimed do if currentSteadyTime>0 then local R=currentSteadyTime-1 currentSteadyTime=R<0 and 0 or R camSway=0 elseif currentSteadyTime==0 then break end RS.RenderStepped:wait()end camSteady=false spawn(function()local R=6.0 local l=0 while true do RS.RenderStepped:wait()local a=l+R l=a>90 and 90 or a if camSteady then break end camSway=numLerp(0,S.scopeSettings.camSwayOnBreath,1-COS(RAD(l)))if l==90 then break end end R=1.5/S.scopeSettings.breathTime l=0 while true do RS.RenderStepped:wait()local a=l+R l=a>90 and 90 or a if camSteady then break end camSway=numLerp(S.scopeSettings.camSwayOnBreath,1,Sine(l))if l==90 then break end end end)retakeBreath()end function retakeBreath()scopeSteady.Text="\082\101-\116\097\107\105\110\103 \066\114\101\097\116\104"scopeSteady.TextColor3=Color3.new(1,0,0)takingBreath=true local R=S.scopeSettings.steadyTime/S.scopeSettings.breathTime while takingBreath do if currentSteadyTime<maxSteadyTime then local l=currentSteadyTime+R currentSteadyTime=l>maxSteadyTime and maxSteadyTime or l elseif currentSteadyTime>=maxSteadyTime then break end RS.RenderStepped:wait()end if takingBreath then scopeSteady.Text="\072\111\108\100 "..(convertKey(S.Keys.scopeSteady).." \116\111 \083\116\101\097\100\121")scopeSteady.TextColor3=Color3.new(1,1,0)takingBreath=false end end
--------------------[ CAMERA STEADYING FUNCTIONS ]------------------------------------

function steadyCamera()
	scopeSteady.Text = "Steadying..."
	scopeSteady.TextColor3 = Color3.new(1, 1, 0)
	camSteady = true
	local originalSway = camSway
	local Increment = 1.5 / 0.6
	local X = 0
	while true do
		RS.RenderStepped:wait()
		local newX = X + Increment
		X = (newX > 90 and 90 or newX)
		if not steadyKeyPressed then
			break
		end
		camSway = numLerp(originalSway, 0, Sine(X))
		if X == 90 then
			break
		end
	end
	while steadyKeyPressed and Aimed do
		if currentSteadyTime > 0 then
			local NewSteadyTime = currentSteadyTime - 1
			currentSteadyTime = (NewSteadyTime < 0 and 0 or NewSteadyTime)
			camSway = 0
		elseif currentSteadyTime == 0 then
			break
		end
		RS.RenderStepped:wait()
	end
	camSteady = false
	spawn(function()
		local Increment = 1.5 / 0.25
		local X = 0
		while true do
			RS.RenderStepped:wait()
			local newX = X + Increment
			X = (newX > 90 and 90 or newX)
			if camSteady then
				break
			end
			camSway = numLerp(0, S.scopeSettings.camSwayOnBreath, 1 - COS(RAD(X)))
			if X == 90 then
				break
			end
		end
		Increment = 1.5 / S.scopeSettings.breathTime
		X = 0
		while true do
			RS.RenderStepped:wait()
			local newX = X + Increment
			X = (newX > 90 and 90 or newX)
			if camSteady then
				break
			end
			camSway = numLerp(S.scopeSettings.camSwayOnBreath, 1, Sine(X))
			if X == 90 then
				break
			end
		end
		--[[for X = 0, 90, 1.5 / 0.2 do
			local Alpha = 1 - COS(RAD(X))--math.log10(X) / math.log10(90)
			camSway = numLerp(0, 3, Alpha)
			RS.RenderStepped:wait()
		end]]
		--[[for X = 0, 90, 1.5 / S.scopeSettings.steadyTime do
			if camSteady then break end
			local Alpha = SIN(RAD(X))
			camSway = numLerp(3, 1, Alpha)
			RS.RenderStepped:wait()
		end]]
	end)
	retakeBreath()
end

function retakeBreath()
	scopeSteady.Text = "Re-taking Breath"
	scopeSteady.TextColor3 = Color3.new(1, 0, 0)
	takingBreath = true
	local Increment = S.scopeSettings.steadyTime / S.scopeSettings.breathTime
	while takingBreath do
		if currentSteadyTime < maxSteadyTime then
			local newSteadyTime = currentSteadyTime + Increment
			currentSteadyTime = (newSteadyTime > maxSteadyTime and maxSteadyTime or newSteadyTime)
		elseif currentSteadyTime >= maxSteadyTime then
			break
		end
		RS.RenderStepped:wait()
	end
	if takingBreath then
		scopeSteady.Text = "Hold " .. convertKey(S.Keys.scopeSteady) .. " to Steady"
		scopeSteady.TextColor3 = Color3.new(1, 1, 0)
		takingBreath = false
	end
end
