-- script


RunService.RenderStepped:Connect(function()
	local currentTime = tick()
	if humanoid.MoveDirection.Magnitude > 0 then -- we are walking
		local bobbleX = math.cos(currentTime * 10) * .15
		local bobbleY = math.abs(math.sin(currentTime * 10)) * .30

		local bobble = Vector3.new(bobbleX, bobbleY, 0)

		humanoid.CameraOffset = humanoid.CameraOffset:lerp(bobble, .25)
	else -- we are not walking
		local t = tick()
		local x = math.cos(t * speed) * intensity
		local y = math.sin(t * speed) * intensity

		local cf = CFrame.new(Vector3.new(x, y, 0), Vector3.new(x*0.95, y*0.95, -10)) + camera.CFrame.Position

		camera.CFrame = camera.CFrame:Lerp(cf * camera.CFrame.Rotation, smoothness)	
	end
end)
