FindPartsInZoneWithWhiteList

Constructor:

FindPartsInZoneWithWhiteList(minPoint,maxPoint,whiteTable,maxParts)

Description

Returns an array, the contents of which are all part objects in the specified zone, only checking the objects in the table.

Parameters

Name Type Description
minPoint Vector3 Minimum point that forms the enclosed area
maxPoint Vector3 Maximum point forms the enclosed area
whiteTable table List of the objects that needs to be checked
maxParts int Maximum number of parts

Return Value

Type Description
table List of found objects

Examples

Continuously seek all parts in the zone from point(0,0,0) to point(10,10,10), only checking the background and the pawn location, and output the names of found parts.

local function MyUpdate()
    local minPoint = Vector3.New(0,0,0)
    local maxPoint = Vector3.New(10,10,10)
    local whiteTable = {WorkSpace. NewBackground, WorkSpace. Spawn}
    local maxParts = 10

    local list = WorkSpace:FindPartsInZoneWithWhiteList(minPoint,maxPoint,whiteTable,maxParts)
    for k,v in pairs(list) do
        printf(v.Name)
        v.Color = Vector3.New(255,0,0)
    end
end
    
local function coroutineUpdate()
    while true do
        coroutine.wait(0.1)
        MyUpdate()
    end
end

coroutine.start(coroutineUpdate)