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

How do I use :remove() correctly?

Asked by 9 years ago
wait(4)

for i,p in pairs(script.Parent:GetChildren()) do
    p.Anchored = false
    wait(.005)
    p.Size = Vector3.new(2,2,2)
    wait(.005)
end
    wait(5)
for i,p in pairs(script.Parent:GetChildren()) do
    p:remove()
    wait(.005)
end

Everything is working correctly. It's just how I want it... except the blocks don't get removed properly. Did I do something incorrectly with it?

2 answers

Log in to vote
1
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago

Remove is deprecated, try destroy.

Remove sets object's parent to nil, destroy sets it to nil and locks it.

And try having the script avoid destroying itself in the loop.

if p~=script then
p:destroy()
wait()
end
0
Thank you! Lightdrago 95 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

Use destroy() ive tried remove before it never works

Answer this question