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

Why this remove only one part?

Asked by 8 years ago

Hello, I wrote a script, which should remove all parts from model, but at the moment remove only one part. Anyone know how to change it or something?

Here is script:

wait(2)
click = script.Parent.ClickDetector

function reset (player)
    if player.TeamColor == script.Parent.Parent.Parent.Parent.TeamColor.Value then
        local storage = game.workspace.PartStorage:GetChildren()
        for i = 1, #storage do
            if storage[i].className == "Part" then
                storage[i]:remove()
                wait(0.3)
            end
        end
    end
end


click.MouseClick:connect(reset)

Answer this question