If I add non-part instances to a raycast filter table, will that cause errors?

I have an enemy NPC that needs to raycast. I have it filter all descendants of the enemy.

local filter = {} --creating table for filterdescendantinstances
	for i, part in pairs(script.Parent:GetDescendants()) do --looping through parts and blacklisting them
		--if part.ClassName == "Part" then
			table.insert(filter, 1, part)
		--end
	end

I did this because there may be mesh parts and other things I need to ignore not known as “parts” and I didn’t want to have to manually account for them all.

Seeing as stuff like scripts and the humanoid will be added to the filter table, will that cause an issue? Or will it not matter?

It won’t cause problems, but it also isn’t necessary for raycast/spatial query parameters. If you wrap the top-level instance in a table and assign the FilterDescendantInstances property to that table, the engine will automatically only consider BaseParts.

wait, so if i just tell it to filter the entire NPC model, it will… do that?

Yep! You can even wrap multiple NPCs into a folder and add that entire folder to the list if you have more than one NPC.