How do i detect is there are parts nearby?

Hello developers,
Im trying to make a room generation system on roblox however im unsure on how to detect whether there would be a part in the way if i were to add 4 studs to a part. For a good example, i am trying to recreate the Baldi Basics Plus generation system as i find it interesting. Here is an example of how their rooms generate: https://www.youtube.com/watch?v=_WJ0dcC9ERg&t

Basically, im wondering on how i would detect if adding 4 studs to a part will make it collide with another part or not.

Multiple ways to achieve this. Using a Raycast or the GetPartsInPart method will both work. Keep in mind that changing a part’s size by 4 studs will only makeit expand in each direction 2 studs instead of one direction 4 studs (parts expand from their center)

You could also likely use workspace:GetPartsBoundInRadius or workspace:GetPartsBoundInBox if you want to extend the size around the part without actually changing the size of the part.

1 Like