Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to find the parts that surround a part?

Asked by 6 years ago

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?

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. awesomeipod 607 — 6y
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 Vulkarin 581 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

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. coolepicjoshua 110 — 6y
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. :) coolepicjoshua 110 — 6y
0
Thanks! Le_Teapots 913 — 6y
Ad

Answer this question