Getting All Contiguous Parts

Edit: SOLVED with outside help.

I want to get all contiguous touching parts (all the parts that touch a part, and the parts that touch them, and so on, until I have all connected parts in an area)

I think this would best be done by using :GetTouchingParts() recursively, but how would I implement this for an unkown number of recursions?

Essentially: How can I implement recursive code with n number of recursions?

1 Like

This would get the touching parts for a single part; Iā€™m looking for a way to repeat this process with all the parts it finds, and then with all the parts it finds touching those parts and so on until all connected parts have been found.

If you have solved the post, please say what the solution is (linking the post that helped you) and mark it as the solution so people coming here in the future can solve it too!