local G=game.Workspace.CurrentCamera local f=game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()local v=f:WaitForChild("\072\117\109\097\110\111\105\100")local e=0 local z=(f.Humanoid.WalkSpeed/2)*GENERAL_DAMPING local j=3.1415926 local r=j/2 local b=false local Y=false v.Strafing:Connect(function(G)Y=G end)v.Jumping:Connect(function()b=false end)v.Swimming:Connect(function()b=false end)v.Running:Connect(function(G)if G>.1 then b=true else b=false end end)local function o(G,f,v)return f+(G-f)*v end while true do(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:Wait()fps=(G.CFrame.p-f.Head.Position).Magnitude if fps<.52 then e=1 else e=0 end if b==true and Y==false then r=r+v.WalkSpeed/92 else if r>0 and r<j/2 then r=o(r,j/2,.9)end if r>j/2 and r<j then r=o(r,j/2,.9)end if r>j and r<j*1.5 then r=o(r,j*1.5,.9)end if r>j*1.5 and r<j*2 then r=o(r,j*1.5,.9)end end if r>=j*2 then r=0 end G.CFrame=(G.CFrame*CFrame.new((math.cos(r)/z)*OFFSET_DAMPING,math.sin(r*2)/((z*2)*OFFSET_DAMPING),e))*CFrame.Angles(0,0,math.sin(r-j*1.5)/((z*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 > 0.1 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
