I’m trying to make a door detect the player if the player is inside a region. The problem is that I can’t figure out how to add multiple parts in the regions ignore list. When I add a table, an error pops up saying
Unable to cast value to Object
Here’s what I’m working with:
local ignoreList = {
-- Ignores everything in the model
doorModel,
doorPart,
doorHitbox,
doorModel.Wall1,
doorModel.Wall2
}
local pos1 = doorHitbox.Position - (doorHitbox.Size / 2)
local pos2 = doorHitbox.Position + (doorHitbox.Size / 2)
local doorRegion = Region3.new(pos1, pos2)
-- Here is the problem
local partsinDoorRegion = game.Workspace:FindPartsInRegion3(doorRegion, ignoreList, 1000)
for i, parts in partsinDoorRegion do
if parts.Parent:FindFirstChild("Humanoid") then
openDoor()
else
closeDoor()
end
end