--Enum.SavedQualitySetting.Automatic



repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Head") 

local Camera=game.Workspace.CurrentCamera
if Camera:FindFirstChild("MotionBlur") then
Camera.MotionBlur:Destroy()
end
local blur=Instance.new("BlurEffect")
blur.Parent=Camera
blur.Size=0
blur.Name="MotionBlur"
local move_anim_speed 				= 3
local last_p 						= Vector3.new()
local move_amm 						= 0


local aim_settings 					= {
	aim_amp 						= 0.5,
	aim_max_change 					= 4,
	aim_retract 					= 15,
	aim_max_deg 					= 20,
}

local last_va 						= 0
local last_va2 						= 0
local view_velocity 				= {0, 0}
local last_time 					= tick()


game:GetService("RunService").RenderStepped:connect(function()
	local delta = tick() - last_time
	last_time = tick()

	
	local p_distance 				= ((Camera.CoordinateFrame.lookVector)).magnitude
	if p_distance == 0 then p_distance = 0.0001 end
	local p_height 					= Camera.CoordinateFrame.lookVector.y 
	local view_angle
	if p_height ~= 0 then
		view_angle 					= math.deg(math.asin(math.abs(p_height) / p_distance)) * (math.abs(p_height) / p_height)
	else
		view_angle 					= 0
	end
	
	local cam_cf 					= Camera.CoordinateFrame
	local looking_at 				= cam_cf * CFrame.new(0, 0, -100)
	local view_angle2 				= math.deg(math.atan2(cam_cf.p.x - looking_at.p.x, cam_cf.p.z - looking_at.p.z)) + 180
	
	local v_delta1, v_delta2
	local dir1, dir2 				= 0, 0
	v_delta1 						= math.abs(view_angle - last_va)
	if v_delta1 ~= 0 then
		dir1 						= (view_angle - last_va) / v_delta1
	end
	local va_check 					= {math.abs(view_angle2 - last_va2), 360 - math.abs(view_angle2 - last_va2)}
	if view_angle2 == last_va2 then
		dir2 						= 0
		v_delta2 					= 0
	elseif va_check[1] < va_check[2] then
		v_delta2 					= va_check[1]
		dir2 						= (view_angle2 - last_va2) / va_check[1]
	else
		v_delta2 					= va_check[2]
		if last_va2 > view_angle2 then
			dir2 					= 1
		else
			dir2 					= -1
		end
	end
	last_va 						= view_angle
	last_va2 						= view_angle2
	
	view_velocity[1] 				= view_velocity[1] / (1 + (delta * aim_settings.aim_retract))
	view_velocity[2] 				= view_velocity[2] / (1 + (delta * aim_settings.aim_retract))
	
	local calc1 					= v_delta1 * dir1 * aim_settings.aim_amp
	if calc1 ~= 0 then
		view_velocity[1] 			= view_velocity[1] + (math.abs(calc1)) * (calc1 / math.abs(calc1))
	end
	local calc2 					= v_delta2 * dir2 * aim_settings.aim_amp
	if calc2 ~= 0 then
		view_velocity[2] 			= view_velocity[2] + (math.abs(calc2)) * (calc2 / math.abs(calc2))
	end
	
	if view_velocity[1] ~= 0 then
		view_velocity[1] 			= math.abs(view_velocity[1]) * (math.abs(view_velocity[1]) / view_velocity[1])
	end
	if view_velocity[2] ~= 0 then
		view_velocity[2] 			= math.abs(view_velocity[2]) * (math.abs(view_velocity[2]) / view_velocity[2])
	end
	local one=math.abs(math.rad(view_velocity[1]))
	local two=math.abs(math.rad(view_velocity[2]))
	local equation=math.max(one,two)*10
    blur.Size=equation
	
	if game.Players.LocalPlayer.Character then
	if game.Players.LocalPlayer.Character:FindFirstChild("Torso") then
	if game.Players.LocalPlayer.Character.Torso.Position.Y <= -2000 then
	game.Players.LocalPlayer.Character.Humanoid.Health = 0
	end
	end
	end
	
end)