For I,V Loop Ignore Itself?

is there anyway to add an ignore list on a For Loop script?

Im new too scripting…

while task.wait() do
	for i,v in pairs(script.Parent.Parent:GetChildren()) do
		if v:IsA('Part') and not table.find(script.Parent) then
	
		end
	end
end
1 Like

You can use table.find and a table for this.

local blacklist = {}
while task.wait() do
        local children  = script.Parent.Parent:GetChildren()
	for i,v in pairs(children) do
		if v:IsA('Part') and not table.find(blacklist,v) then
	
		end
	end
end

I know what blacklist means but, what do I put in it specifically?

well… you’d put script.Parent
It’s a table, so if you want it to ignore many things it would be like

local blacklist = {script.Parent, workspace.Part} --etc
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.