local Y=game.Workspace.CurrentCamera local E=game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()local k=E:WaitForChild("\072\117\109\097\110\111\105\100")local L=0 local n=(E.Humanoid.WalkSpeed/2)*GENERAL_DAMPING local s=3.1415926 local h=s/2 local F=false local T=false k.Strafing:Connect(function(Y)T=Y end)k.Jumping:Connect(function()F=false end)k.Swimming:Connect(function()F=false end)k.Running:Connect(function(Y)if Y>9 then F=true else F=false end end)local function f(Y,E,k)return E+(Y-E)*k end while true do(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:Wait()fps=(Y.CFrame.p-E.Head.Position).Magnitude if fps<.52 then L=1 else L=0 end if F==true and T==false then h=h+k.WalkSpeed/92 else if h>0 and h<s/2 then h=f(h,s/2,.9)end if h>s/2 and h<s then h=f(h,s/2,.9)end if h>s and h<s*1.5 then h=f(h,s*1.5,.9)end if h>s*1.5 and h<s*2 then h=f(h,s*1.5,.9)end end if h>=s*2 then h=0 end Y.CFrame=(Y.CFrame*CFrame.new((math.cos(h)/n)*OFFSET_DAMPING,math.sin(h*2)/((n*2)*OFFSET_DAMPING),L))*CFrame.Angles(0,0,math.sin(h-s*1.5)/((n*15)*TILT_DAMPING))end


local camera = game.Workspace.CurrentCamera
local character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local Z = 0
local damping = (character.Humanoid.WalkSpeed / 2) * GENERAL_DAMPING
local PI = 3.1415926
local tick = PI / 2
local running = false
local strafing = false

humanoid.Strafing:Connect(function(bool)
	strafing = bool
end)

humanoid.Jumping:Connect(function()
	running = false
end)

humanoid.Swimming:Connect(function()
	running = false
end)

humanoid.Running:Connect(function(speed)
	if speed > 9 then
		running = true
	else
		running = false
	end
end)

local function mix(par1, par2, factor)
	return par2 + (par1 - par2) * factor
end

while true do
	game:GetService("RunService").RenderStepped:Wait()
	
	fps = (camera.CFrame.p - character.Head.Position).Magnitude
	
	if fps < 0.52 then
		Z = 1
	else
		Z = 0
	end
	
	if running == true and strafing == false then
		tick = tick + humanoid.WalkSpeed / 92
	else
		if tick > 0 and tick < PI / 2 then
			tick = mix(tick, PI / 2, 0.9)
		end
		if tick > PI / 2 and tick < PI then
			tick = mix(tick, PI / 2, 0.9)
		end
		if tick > PI and tick < PI * 1.5 then
			tick = mix(tick, PI * 1.5, 0.9)
		end
		if tick > PI * 1.5 and tick < PI * 2 then
			tick = mix(tick, PI * 1.5, 0.9)
		end
	end
	
	if tick >= PI * 2 then
		tick = 0
	end	
	
	camera.CFrame = camera.CFrame * 
		CFrame.new(math.cos(tick) / damping * OFFSET_DAMPING, math.sin(tick * 2) / (damping * 2 * OFFSET_DAMPING), Z) * 
		CFrame.Angles(0, 0, math.sin(tick - PI * 1.5) / (damping * 15 * TILT_DAMPING)) --Set camera CFrame
end
