How can I check if there are frames touching at all

I have a drawing system, but here is an error, when making an error only a little bit touches (like shown below)

I need to check if there is another frame like that so then I can do this

I was thinking to send the last positions something was placed and SOMEHOW (not sure how yet) to calculate if they should connect. Help appreciated thanks in advanced.

Yeah, get the frames position and size as UDim2 values and their rotations as a number value (if those are scaled then get the absolute size of the containing ScreenGui itself as well), then simply calculate whether or not they would overlap.