How does Find Parts In Region 3 With White List work?

I don’t know how FindPartsInRegion3WithWhiteList works. Can someone give me an code example or an explaination please? Thanks for help

FindPartsInRegion3WithWhiteList does as what the name suggests.

It expects at least 2 given arguments, the region to find parts in, and a table containing the parts that should be detected by the region, descendants included. The Region will only return the parts it found that are in that whitelist, if it has found any other parts that aren’t in the whitelist, it will not return them

Say you have a region set up, and you have 2 parts, Bob and Steve and Mike, and you want to only detect Bob and Mike, so you do

local parts = workspace:FindPartsInRegion3WithWhiteList(region,{workspace.Bob, workspace.Mike})

Now say all of those 3 parts are in the region, if you print out the parts variable, it’ll only print Bob and Mike, as those are the only parts in the whitelist, Steve isn’t in the whitelist so it is not detected

There is also a 3rd argument you can give which is the max amount of parts to detect

2 Likes