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 use :remove() correctly?

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

✓ Accepted answer

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

1 comment

0

Thank you!

Use destroy() ive tried remove before it never works

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