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

How do i remove multiple items at once?

Asked by 10 years ago

Here is my code:

for i,v in pairs (game.Workspace:GetChildren()) do
    if v.Name == "Bricktops" or "Pitgrounds" then
        v:remove()
    end
end

But the line:

v:remove()

Is wrong, How do i remove multiple items at once?

3 answers

Log in to vote
1
Answered by 10 years ago
for i,v in pairs (game.Workspace:GetChildren()) do
if v.Name:lower() == ("Bricktops"):lower() or v.Name:lower() == ("Pitgrounds"):lower() then
v:remove()
end end
Ad
Log in to vote
1
Answered by
HexC3D 830 Moderation Voter
10 years ago
for i,v in pairs (game.Workspace:GetChildren()) do
    if v.Name == "Bricktops" or "Pitgrounds" then
        v:Destroy()
    end
end

Destroy()Would be the correct term.

Log in to vote
-1
Answered by
wazap 100
10 years ago

That isnt the problem here, although I agree that :Destroy is better than :remove()

for i,v in pairs (game.Workspace:GetChildren()) do
    if v.Name == "Bricktops" or v.Name=="Pitgrounds" then
        v:Destroy()
    end
end

0
That's what I said.... HexC3D 830 — 10y
0
Mine answered 2 hours ago , wazap answered 1 hour ago !!!, Copy much? HexC3D 830 — 10y
0
No. In case you didnt notice, I changed something in the if-then statement wazap 100 — 10y

Answer this question