Is there any way to find if a part telported in another?

I am trying to make a dungeon that automatically generates using corridors and rooms.
My script uses math.random to chose a model then teleports the main part of the model (changes cframe) and the rest of the model automatically welds correctly to the main part.
The main room has 4 heads and the corridors can generate other rooms/ corridors and so on.
In this way I can generate a level of the dungeon using rng but sometimes corridors intersect each other.

Can I use some sort of event to find if some parts are loading in the same spot so I can make an intersection?
If so, then how?

(note that the code doesn’t have any problem and this only randomly generates rarely)
If I teleport a part inside of other one the touch event doesn’t work.

1 Like

There are methods for this to never happen in the first place, but I don’t really feel like going into a deep dive right now. If you want a patch solution, just use one of the OverlapParams such as GetPartsInPart.

2 Likes

Thanks!
This is exactly what I needed.

2 Likes