I am currently looking for a script when a Frame touches the other one, it prints something out. I do not have a code, but I have a game if more info is needed: https://www.roblox.com/games/3481420494/frisk-moving-test
This function takes four Vector2 positions ("corners"). Returns true if the produced rectangles overlap, false if they don't.
function PositionsOverlap (corner1, corner2, corner3, corner4) -- corner1 is a corner of the first frame -- corner2 is the corner opposite to corner1 in the first frame -- same idea for corner3 and corner4, but they're for the second frame local adj_cornerm = Vector2.new (math.min (corner1.X, corner2.X), math.min (corner1.Y, corner2.Y)) local adj_cornerM = Vector2.new (math.max (corner1.X, corner2.X), math.max (corner1.Y, corner2.Y)) local rel_cornerA = Vector2.new (math.min (corner3.X, corner4.X), math.min (corner3.Y, corner4.Y)) - adj_cornerm local rel_cornerB = Vector2.new (math.max (corner3.X, corner4.X), math.max (corner3.Y, corner4.Y)) - adj_cornerm local rel_cornerC = Vector2.new (math.min (corner3.X, corner4.X), math.max (corner3.Y, corner4.Y)) - adj_cornerm local rel_cornerD = Vector2.new (math.max (corner3.X, corner4.X), math.min (corner3.Y, corner4.Y)) - adj_cornerm local width = adj_cornerM.X - adj_cornerm.X local height = adj_cornerM.Y - adj_cornerm.Y for _, corner in pairs ({rel_cornerA, rel_cornerB, rel_cornerC, rel_cornerD}) do if corner.X >= 0 and corner.Y >= 0 and corner.X < width and corner.Y < height then return true end end return rel_cornerA.X <= 0 and rel_cornerA.Y <= 0 and rel_cornerB.X >= width - 1 and rel_cornerB.Y >= height - 1 end -- this prints true print (PositionsOverlap (Vector2.new (0, 0), Vector2.new (2, 2), Vector2.new (1, 1), Vector2.new (3, 3))) -- this prints false print (PositionsOverlap (Vector2.new (0, 0), Vector2.new (1, 1), Vector2.new (2, 2), Vector2.new (3, 3))) -- this prints true print (PositionsOverlap (Vector2.new (6, 10), Vector2.new (7, 12), Vector2.new (6.5, 11), Vector2.new (1, 3))) -- this prints true print (PositionsOverlap (Vector2.new (6, 10), Vector2.new (7, 12), Vector2.new (20, 20), Vector2.new (1, 3)))