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
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].
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