Add table to raycast ignorelist

Greetings,

I’ve recently begun to experiment with raycasting. Is there a way to implement a table to a raycast ignorelist?

IgnoreParts = {}
Params.FilterDescendantsInstances = {IgnoreParts}

Magma ball that is being detected:

local ClonedBall = MagmaBall:Clone()

ClonedBall.PrimaryPart.CFrame = ClonedBlast.PrimaryPart.CFrame * CFrame.new(randCFX,randCFY,randCFZ)

ClonedBall.Parent = DebrisFolder

ClonedBall.Name = "Magma "..i

table.insert(IgnoreParts,ClonedBall:GetChildren())

Even after printing: print(Params.FilterDescendantsInstances)
it shows that magmaball is indeed inside of it.

Again, this is probably an easy fix - any help is appreciated. Water_KKnight

1 Like

Is this part run only once? Or is it in a loop somewhere else?

1 Like

it is running in a for-loop (raycast below part). Either way it doesn’t seem to be adding ‘v’ into the raycast ignorelist, but it’s adding it into the table.

Why do you put the IgnoreParts table inside another table instead of just doing this?

Params.FilterDescendantsInstances = IgnoreParts

For Debris you can just work with collision groups for raycast Params and it’ll update automatically without any more table manipulation.

because it has a few other parameters that are not shown In the script above

coroutine.wrap returns a function, so you actually have to call it. coroutine.wrap(function() -- Code end)()

1 Like

Okay - then do

Params.FilterDescendantsInstances = { unpack(IgnoreParts), otherInstance1, otherInstance2 }

This should add all elements of IgnoreParts to FilterDescendantsInstances, as well as the other instances

1 Like