Hi everyone!
I am curious as to how I would rotate a frame to meet 2 points on opposite sides. Currently, I am making a drawing system and used the distance formula to determine the length between the two dots. When the cursor moves quicker, the dots are more spread out which is why I am using frames to fill in the holes between them. Note, that I am using scale for these frames. I also used a formula to convert absolute position to scale.
posX = (Frame1x + Frame2x)/2
posY = (Frame1y + Frame2y)/2
local newLine = Instance.new("Frame")
newLine.Position = UDim2.new(posX,0,posY,0)
local newAbsPosFrm1X = convertOffPosToScaleX(Frame1.AbsolutePosition.X)
local newAbsPosFrm2X = convertOffPosToScaleX(Frame2.AbsolutePosition.X)
local newAbsPosFrm1Y = convertOffPosToScaleY(Frame1.AbsolutePosition.Y)
local newAbsPosFrm2Y = convertOffPosToScaleY(Frame2.AbsolutePosition.Y)
local distanceX = newAbsPosFrm1X - newAbsPosFrm2X
local distanceY = newAbsPosFrm1Y - newAbsPosFrm2Y
local distance = Vector2.new(distanceX*3,distanceY).Magnitude
newLine.Size = UDim2.new(distance,0,size,0)
local y = newAbsPosFrm1Y-newAbsPosFrm2Y
local x = newAbsPosFrm1X - newAbsPosFrm2X
newLine.Rotation = (math.atan2(y,x)*180.5/math.pi)
Currently my current rotation formula is not giving me my desired results: