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

Specifically Remove a ClassName From the list?

I want this script to remove the "ClassName" From the "ClassList" m[i] Fails To read the ClassList and comes with an error

Unless there is another way to do this?

while true do
	wait(1)
	local m = script.Parent:GetChildren()
	for i = 1, #m do

classlist = {"Sky","BloomEffect","BlurEffect","ColorCorrectionEffect","SunRayEffect"} 	
--Classlist the stuff that wants to get removed		

		if m[i].className == classlist then
			m[i]:Remove()

		end

	end
end

4 comments

0

table.remove(classlist,i)

0

Not what he wants ^

0

line 9 if m.ClassName == classlist[i] then -- delete it end

0

I just need the Classlist to remove the classname that the script searches in the game network.

2 answers

✓ Accepted answer
while true do
    wait(1)
    local m = script.Parent:GetChildren()
    for i = 1, #m do

classlist = {"Sky","BloomEffect","BlurEffect","ColorCorrectionEffect","SunRayEffect"}   
--Classlist the stuff that wants to get removed     
	for j=1,#classlist do
            if m[i].className== classlist[j] then
                m[i]:Remove()
            end
        end
    end
end

So the problem is you have to create a nested for loop because you can't just have a single class name equal to an entire table. It will check if m[0] is equal to classlist[0 through 5] before going to m[1].

4 comments

0

Hope this helps explain things well enough

0

Yeah i understand now what tables does.

0

If this solves your problem, then you should mark this as the accepted answer

0

Definitely!

Try using adding another for loop to check if the name of the current className is in the class list: for j=1, #classlist do if m[i].ClassName == classlist[j] then m[i]:Remove() end end

1 comment

0

Error for for j=1, #classlist do if

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