I made function to draw line from (x1, y1) to (x2, y2):
local function drawLine(parent: Instance, x1: number, y1: number, x2: number, y2: number, color: Color3, thickness: number?): Frame
local centerX = (x1 + x2) / 2
local centerY = (y1 + y2) / 2
local deltaX = math.abs(x1 - x2) ^ 2
local deltaY = math.abs(y1 - y2) ^ 2
local distance = math.sqrt(deltaX + deltaY)
local rotation = math.deg(math.atan2(y1 - y2, x1 - x2))
local frame = Instance.new("Frame", parent)
frame.AnchorPoint = Vector2.new(.5, .5)
frame.Position = UDim2.fromOffset(centerX, centerY)
frame.Size = UDim2.fromOffset(distance, thickness or 1)
frame.Rotation = rotation
frame.BackgroundColor3 = color
frame.BorderSizePixel = 0
return frame
end
It creates a frame in parent and calculates its position, size and rotation.