I want to check if two GUI’s are touching. I can currently do this with a recursive loop and a bunch of if statements but I think this is something that would be valuable to developers.

My current use case is a semi-volumetric-based chat that places chat bubbles on your 2D ScreenGui where the said players chatted. If two chats overlap, the older chat needs to move up slightly.


I think he means the loop part in terms of just what he is doing to go through all of the chat bubbles (I could be wrong though).


Another useful function would be to pass a Vector2/UDim to see if the point is inside the Gui.

Yup! That’s what I do now and it’s not pretty, especially since I have to run it both on a loop and recursively to make sure it’s done in order.

1 Like

The combination of my own code + the code I have to put in in place of the InsideOf() makes it a mess.

It’s hard for me to keep track of. I think new developers would greatly benefit from something like this since for me it shortens 150 characters down to about 50.

1 Like

150 characters isn’t even a lot.
2D collision checking is easy enough as it is.
If your code is a mess then your structure is bad.


OT but couldn’t you simplify your layering logic buy just using table.sort for “arrival times” on the chat messages? Your ZIndex just becomes a varation of the chat message table index and you can work around the overlapping other guis by just using DisplayOrder on ScreenGuis.

They’re generated one by one

1 Like