input.InputChanged:connect(function(P)if P.UserInputType==Enum.UserInputType.MouseMovement then local Y=Vector2.new(P.Delta.x/Sensitivity,P.Delta.y/Sensitivity)*Smoothness local r=TargetAngleX-Y.y TargetAngleX=r>=80 and 80 or r<=-80 and-80 or r TargetAngleY=(TargetAngleY-Y.x)%360 end end)input.InputBegan:connect(function(P)if P.UserInputType==Enum.UserInputType.Keyboard then if P.KeyCode==CanToggleMouse.activationkey then if CanToggleMouse.allowed and freemouse==false then freemouse=true else freemouse=false end end end if P.UserInputType==Enum.UserInputType.Keyboard then if P.KeyCode==Enum.KeyCode.W then w=true end if P.KeyCode==Enum.KeyCode.A then a=true end if P.KeyCode==Enum.KeyCode.S then s=true end if P.KeyCode==Enum.KeyCode.D then d=true end if P.KeyCode==Enum.KeyCode.LeftShift then lshift=true end end end)input.InputEnded:connect(function(P)if P.UserInputType==Enum.UserInputType.Keyboard then if P.KeyCode==Enum.KeyCode.W then w=false end if P.KeyCode==Enum.KeyCode.A then a=false end if P.KeyCode==Enum.KeyCode.S then s=false end if P.KeyCode==Enum.KeyCode.D then d=false end if P.KeyCode==Enum.KeyCode.LeftShift then lshift=false end end end)


input.InputChanged:connect(function(inputObject)
	
	if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
		local delta = Vector2.new(inputObject.Delta.x/Sensitivity,inputObject.Delta.y/Sensitivity) * Smoothness

		local X = TargetAngleX - delta.y 
		TargetAngleX = (X >= 80 and 80) or (X <= -80 and -80) or X 
		TargetAngleY = (TargetAngleY - delta.x) %360 
	end	
	
end)

input.InputBegan:connect(function(inputObject)
	
	if inputObject.UserInputType == Enum.UserInputType.Keyboard then
		if inputObject.KeyCode == CanToggleMouse.activationkey then
			if CanToggleMouse.allowed and freemouse == false then
				freemouse = true
			else
				freemouse = false
			end
		end
	end
	
	if inputObject.UserInputType == Enum.UserInputType.Keyboard then
		if inputObject.KeyCode == Enum.KeyCode.W then
			w = true
		end
		
		if inputObject.KeyCode == Enum.KeyCode.A then
			a = true
		end
		
		if inputObject.KeyCode == Enum.KeyCode.S then
			s = true
		end
		
		if inputObject.KeyCode == Enum.KeyCode.D then
			d = true
		end
		
		if inputObject.KeyCode == Enum.KeyCode.LeftShift then
			lshift = true
		end
	end
end)

input.InputEnded:connect(function(inputObject)
	if inputObject.UserInputType == Enum.UserInputType.Keyboard then
		if inputObject.KeyCode == Enum.KeyCode.W then
			w = false
		end
		
		if inputObject.KeyCode == Enum.KeyCode.A then
			a = false
		end
		
		if inputObject.KeyCode == Enum.KeyCode.S then
			s = false
		end
		
		if inputObject.KeyCode == Enum.KeyCode.D then
			d = false
		end
		
		if inputObject.KeyCode == Enum.KeyCode.LeftShift then
			lshift = false
		end
	end
end)
