GUI Minigame help

Hello, im making a GUI minigame and i need a line to be created at a given location and another location, it would size correctly, and it would be in the middle of both positions.

like a line trail:

Example: GTA 5 Fleeca Bank Job

My Code:

llocal UserInterfaceTrailService = {}

local DefaultConfig = {
    TrailColor = Color3.new(0.250980, 0.474509, 0.341176),
    TrailOffset = UDim2.new(0, 0, 0, 0),
}

local function AddDetail()
    local UICorner = Instance.new("UICorner")

    return {UICorner = UICorner}
end

local function LineCreate(StartFrame, Config)
    local Trail = Instance.new("Frame")
    Trail.AnchorPoint = Vector2.new(0.5, 0.5)
    Trail.Position = StartFrame.Position
    Trail.BackgroundColor3 = Config.TrailColor

    local Detail = AddDetail()

    for _,v in pairs(Detail) do
        v.Parent = Trail
    end

    return Trail
end

local function CalculateTheSize(StartFrame, FollowingFrame)
    return math.sqrt((StartFrame.AbsolutePosition.X - FollowingFrame.AbsolutePosition.X) ^2 + (StartFrame.AbsolutePosition.Y - FollowingFrame.AbsolutePosition.Y) ^2)
end

local function CalculateThePosition(StartFrame, FollowingFrame)
    local v2 = StartFrame.AbsolutePosition + FollowingFrame.AbsolutePosition / 2
    return UDim2.new(v2.X, v2.Y)
end

local function TrailInfoSet(StartFrame, FollowingFrame, Trail)
    Trail.Size = UDim2.new(CalculateTheSize(StartFrame, FollowingFrame))
    Trail.Position = CalculateThePosition(StartFrame, FollowingFrame)
end

function UserInterfaceTrailService:CreateNewTrail(StartFrame, FollowingFrame, Config)
    if StartFrame == nil then error("Please Send In A StartFrame") end
    if FollowingFrame == nil then error("Please Send In A FollowingFrame") end
    if Config == nil then Config = DefaultConfig end

    local Trail = LineCreate(StartFrame, Config)
    TrailInfoSet(StartFrame, FollowingFrame, Trail)
    Trail.Parent = StartFrame

    return Trail
end

function UserInterfaceTrailService:TrailUpdate(StartFrame, FollowingFrame, Trail, XYZ, Dir)
    TrailInfoSet(StartFrame, FollowingFrame, Trail)
end

return UserInterfaceTrailService