How would I detect an overlapping GUI Object?

How would I detect if two frames were overlapping eachother?

1 Like

This might be what you are looking for. If you are trying to look for an overlapping UI in all positions, you will have to loop through all descendants of PlayerGui.

Use this line of code:

--For Y position
math.abs(guiobject1.Position.Y.Scale - guiobject2.Position.Y.Scale)
--For X position
math.abs(guiobject1.Position.X.Scale - guiobject2.Position.X.Scale)
--This will return the relative position of the two objects which is called Magnitude or Distance, same thing as (Part1.Position - Part2.Position).Magnitude.