Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Error with FindPartsInRegion3WithIgnoreList?

Asked by 7 years ago

Working on a script that checks the amount of players in a region by checking the amount of "Torsos" in the region. The script is activated when a part is touched. It works fine in FindPartsInRegion3, but when I use FindPartsInRegion3WithIgnoreList there seems to be a problem with my Ignore table, but I'm not sure what the problem is.

Error: 23:15:07.478 - Unable to cast value to Objects 23:15:07.478 - Script 'ServerScriptService.Script', Line 30 - global GatherAmount 23:15:07.479 - Script 'ServerScriptService.Script', Line 81 23:15:07.479 - Stack End

My code (There is more, but this is where the problem lies):

local Ignore = {"Right Leg","Right Arm","Left Leg","Left Arm","Head","HumanoidRootPart"}
local R = Region3.new(
    Vector3.new(
        math.min(Pos1.X,Pos2.X),
        math.min(Pos1.Y,Pos2.Y),
        math.min(Pos1.Z,Pos2.Z)
        ),
    Vector3.new(
        math.max(Pos1.X,Pos2.X),
        math.max(Pos1.Y,Pos2.Y),
        math.max(Pos1.Z,Pos2.Z)
        )
    )



function GatherAmount() 
    local Red = {}
    local Blue = {}
    local IsOnBlue = false
    for i,v in pairs (game.Workspace:FindPartsInRegion3WithIgnoreList(R,Ignore,100)) do

Answer this question