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

How to make script.Parent:Remove() more efficient?

So am working on a Sinking Ship Simulator and I want to make my scripts more efficient instead of having tons of bricks under the unanchored ship model that have this script in them:

wait (195)
script.Parent:Remove()

What would be a more efficient script that would move the ship without needing this script or bricks under the ship?

1 comment

0

What? Also, you should use :Destroy() Instead of Remove because remove is deprecated.

1 answer

✓ Accepted answer

A good solution would be to put all the bricks you want to remove in a model and call the Destroy method on that model.

You'd end up with mostly the same script, though since you don't need to use the model or parts again you should use Destroy instead of Remove

wait(195)
script.Parent:Destroy()

That would eliminate having to put multiple scripts in every part.

3 comments

0

Great answer! So glad someone came up with this great idea.

1

Even better, you can simply loop through all the parts and destroy each one, instead of putting an individual script in each.

0

How would I loop it?

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