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

how make a script ignore everything in a table?

script and title should probably explain

local settings = require(script.Parent.Parent.ModuleScript)

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.CanvasPosition = Vector2.new(settings.frame[script.Parent.Name])
	for i,names in pairs(settings.ignore()) do
		for i,v in pairs(script.Parent.Parent:GetChildren()) do
			if v.Name ~= names and v.Name ~= script.Parent.Name.."".."Song" then
				v.Visible = false
			end
		end
	end
end)

the for i script is the one not working but i don't understand why

1 answer

If your blacklist is a simple array then you're going about it wrong. If you want to check whether a part's name is in a table it should go like this:

local IgnoreList = { "Torso", "Head", "Left Leg" }

for i,child in pairs(Character:GetChildren()) do
	if not table.find(IgnoreList, child.Name) and not child.Name == script.Parent.Name.." ".."Song" then
		child.Visible = false
	end
end

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