Any ideas why this is happening?
Btw, I am used aspect ratio constraint.
local xPos = Mouse.X
local yPos = Mouse.Y
local paintCloned = paint:Clone()
local offset = Vector2.new(math.abs(xPos - canvas.AbsolutePosition.X), math.abs(yPos - canvas.AbsolutePosition.Y))
paintCloned.Size = UDim2.new(0, size, 0, size)
paintCloned.Position = UDim2.new(0, offset.X, 0, offset.Y)
paintCloned.ImageTransparency = 1
paintCloned.Parent = canvas
if num == 2 then
num = 1
Frame2x = paintCloned.Position.X.Offset
Frame2y = paintCloned.Position.Y.Offset
Frame2 = paintCloned
else
num = 2
Frame1x = paintCloned.Position.X.Offset
Frame1y = paintCloned.Position.Y.Offset
Frame1 = paintCloned
end
if Frame1 and Frame2 ~= nil then
posX = (Frame1x + Frame2x)/2
posY = (Frame1y + Frame2y)/2
local newLine = Instance.new("Frame")
newLine.Position = UDim2.new(0,posX,0,posY)
local distanceX = Frame1.AbsolutePosition.X - Frame2.AbsolutePosition.X
local distanceY = Frame1.AbsolutePosition.Y - Frame2.AbsolutePosition.Y
local distance = Vector2.new(distanceX,distanceY).Magnitude
newLine.Size = UDim2.new(0,distance+10,0,size)
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.Name = "BackgroundThing"
newLine.AnchorPoint = Vector2.new(0.5,0.5)
newLine.BackgroundColor3 = Color3.fromRGB(0,0,0)
newLine.BorderSizePixel = 0
newLine.BorderColor3 = Color3.fromRGB(0,0,0)
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(1,0)
corner.Parent = newLine
newLine.Parent = canvas
for i, v in pairs(canvas:GetChildren()) do
if v:IsA("Frame") or v:IsA("ImageLabel") and v.Name ~= "DrawingFrame" then
local vXPos, vYPos = v.Position.X.Offset, v.Position.Y.Offset
if vXPos ~= 0 and vYPos ~= 0 then
local newVPosX, newVPosY = convertOffPosToScaleX(vXPos), convertOffPosToScaleY(vYPos)
v.Position = UDim2.new(newVPosX,0,newVPosY,0)
end
local vXSize, vYSize = v.Size.X.Offset, v.Size.Y.Offset
if vXSize ~= 0 and vYSize ~= 0 then
local newVSizeX, newVSizeY = convertOffPosToScaleX(vXSize), convertOffPosToScaleY(vYSize)
v.Size = UDim2.new(newVSizeX,0,newVSizeY,0)
end
end
end