FindPartsInZone

Constructor:

FindPartsInZone(minPoint,maxPoint,ignoreInstance,maxParts)

Description

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

Parameters

Name Type Description
minPoint Vector3 Minimum point that forms the enclosed area
maxPoint Vector3 Maximum point forms the enclosed area
ignoreInstance RWObject Objects to ignore
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), 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 ignoreInstance = WorkSpace. NewBackground
    local maxParts = 10
    local list = WorkSpace:FindPartsInZone(minPoint,maxPoint,ignoreInstance,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)