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

How do i remove multiple items at once?

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

✓ Accepted answer
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
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.

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

3 comments

0

That's what I said....

0

Mine answered 2 hours ago , wazap answered 1 hour ago !!!, Copy much?

0

No. In case you didnt notice, I changed something in the if-then statement

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