Could this be moved to engine bugs please as I cannot post there?
I was attempting to add a large amount of specific objects into RaycastParams.FilterDescendantsInstances at runtime using table.insert(), but it doesn’t work, nor does it throw an error. I did find a work around though.
I don’t know if this is an intentional aspect, I apologize for posting this if it is intentional though.
If you use table.unpack after inserting the table into RaycastParams it appears to work fine. This is the current method I am using as a work around.
This doesnt work
local Part = Instance.new("Part")
Part.Parent = workspace
local RaycastParameters = RaycastParams.new()
RaycastParameters.FilterDescendantsInstances = {}
table.insert(RaycastParameters.FilterDescendantsInstances, Part)
This does work
local Part = Instance.new("Part")
Part.Parent = workspace
local RaycastParameters = RaycastParams.new()
RaycastParameters.FilterDescendantsInstances = {}
local TempTable = {}
table.insert(TempTable, Part)
RaycastParameters.FilterDescendantsInstances = {table.unpack(TempTable)}
The examples shown above are not the code I am using, they just specifically show that table.insert doesn’t work. I am aware I could just add “Part” to the table, but that is not the point of the examples. Thanks and have a good one
!