Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to find the parts that surround a part?

Hello! I have been attempting to find the parts that surround a particular part, but every method I have tried has not worked. I considered firing rays in each direction but I couldn't figure that out. What are my options?

2 comments

0

No need for rays. Get a chase script from a zombie, it uses distance to find the nearest humanoid. You can edit it to detect parts surrounding the object.

1

can I see what you attempted with the rays? Or possibly another alternative may be to do something like a Region3 around the part http://wiki.roblox.com/index.php?title=API:Class/Workspace/FindPartsInRegion3WithWhiteList

1 answer

✓ Accepted answer

You could make use of the GetConnectedParts() or the GetTouchingParts() functions. There may also be some other pre-built functions for BaseParts that could be useful to you, I suggest giving this article a look.

3 comments

0

I took a look at these, but the way my project is set up makes it so that all of my parts are adjacent.

0

I created a pseudo-part that surrounds the original part but with its' sides expanded half a stud on each side, and then used GetTouchingParts() and it worked! I will accept this answer. :)

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.