Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Specifically Remove a ClassName From the list?

Asked by 6 years ago
Edited 6 years ago

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
0
table.remove(classlist,i) Gey4Jesus69 2705 — 6y
0
Not what he wants ^ greatneil80 2647 — 6y
0
line 9 if m.ClassName == classlist[i] then -- delete it end greatneil80 2647 — 6y
0
I just need the Classlist to remove the classname that the script searches in the game network. S0NIC_Dev 61 — 6y

2 answers

Log in to vote
0
Answered by
SteamG00B 1633 Moderation Voter
6 years ago
Edited 6 years ago
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].

0
Hope this helps explain things well enough SteamG00B 1633 — 6y
0
Yeah i understand now what tables does. S0NIC_Dev 61 — 6y
0
If this solves your problem, then you should mark this as the accepted answer SteamG00B 1633 — 6y
0
Definitely! S0NIC_Dev 61 — 6y
Ad
Log in to vote
0
Answered by
Nickzus 24
6 years ago
Edited 6 years ago

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

0
Error for for j=1, #classlist do if S0NIC_Dev 61 — 6y

Answer this question