AspectRatio messing up drawing system on different resolutions

Hi everyone! I developed a drawing system, however, I am using AspectRatio to keep the rotations in place even when the player scales their screen. When they do this action and try to draw again, all the drawing features get messed up. Can anyone help me understand how to work around this?

		local mousePosXScale, mousePoxYScale = convertOffPosToScaleX(Mouse.X), convertOffPosToScaleY(Mouse.Y)
		local frame = Instance.new("Frame")
		frame.Position = UDim2.new(mousePosXScale,0,mousePoxYScale,0)
		frame.BackgroundColor3 = Color3.fromRGB(0,0,0)
		frame.Size = UDim2.new(convertOffPosToScaleX(size),0,convertOffPosToScaleY(size),0)
		frame.AnchorPoint = Vector2.new(0.5,0.5)
		frame.Parent = script.Parent.Frame
		--frame.BackgroundTransparency = 1
		
		
		
		local UiCorner = Instance.new("UICorner")
		UiCorner.CornerRadius = UDim.new(1,0)
		UiCorner.Parent = frame
		
		if currentNum == 2 then
			currentNum = 1
			Frame1X = frame.Position.X.Scale
			Frame1Y = frame.Position.Y.Scale
			Frame1 = frame
		else
			currentNum = 2
			Frame2X = frame.Position.X.Scale
			Frame2Y = frame.Position.Y.Scale
			Frame2 = frame
			
		end
		
		if Frame1 ~= nil and Frame2 ~= nil then
			local posX = (Frame1X + Frame2X)/2
			local posY = (Frame1Y + Frame2Y)/2
			
			
			
			local distanceX = convertOffPosToScaleX(Frame1.AbsolutePosition.X - Frame2.AbsolutePosition.X)
			local distanceY = convertOffPosToScaleY(Frame1.AbsolutePosition.Y - Frame2.AbsolutePosition.Y) 
			
			
			local newLine = Instance.new("Frame")
			
			local distance = Vector2.new(distanceX,distanceY).Magnitude
			
			newLine.Position = UDim2.new(posX,0,posY,0)
			newLine.Size = UDim2.new(distance,0,convertOffPosToScaleY(size),0)
			newLine.AnchorPoint = Vector2.new(0.5,0.5)
			
			local y = Frame1.AbsolutePosition.Y-Frame2.AbsolutePosition.Y
			local x = Frame1.AbsolutePosition.X - Frame2.AbsolutePosition.X
			
			newLine.Rotation = math.atan2(y,x)*180/math.pi
			newLine.BackgroundColor3 = Color3.fromRGB(0,0,0)
			newLine.BorderColor3 = Color3.fromRGB(0,0,0)
			newLine.Parent = script.Parent.Frame
			
			local uiCorner = Instance.new("UICorner")
			uiCorner.CornerRadius = UDim.new(1,0)
			uiCorner.Parent = newLine
			
			
			
		end