Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

FindPartOnRayWithIgnoreList isn't working plz help?

so i made a raycast but i made it so it only detects one part every other part, it doesn't detect so how i did that is i made a for loop that loops threw all the decendance of workspace and if it is a part or a mesh part then if it is not the part that i want to detect then it gets inserted into the ignore list here it is in code

--part is the only part i don't want to ignore/insert it into the table
local list = {}
for i, partnew in pairs(workspace:GetDescendants()) do
	if partnew:IsA("Part") or partnew:IsA("MeshPart") then
		if partnew ~= part then
			table.insert(list,part)	
		end
	end
end

then the raycasting is here

local hit,Position,norm = workspace:FindPartOnRayWithIgnoreList(raycast, list)

now here is the problem, it never detects the part i want to detect i tried commenting out line 6 and it works so i think it is adding the part but when i put a print statment and look threw it, i never see it adding the part please help :/

1 answer

✓ Accepted answer

We solved the issue in the chat, in table.insert(list,part) part should be replaced with partnew.

This discussion is preserved as it was. New answers, comments, and votes are closed.