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

:Clone() vs. Instance.new(). Which one is more efficient?

Hi. I am writing a script which requires the replication of BaseParts when prompted by user input. If I was replicating Models, I would definitely use :Clone() and store the model in ServerStorage, but since I'm just replicating BaseParts, I'm not sure if I should put the desired BasePart in ServerStorage and clone it, or instantiate a new BasePart in the script using Instance.new(). Thanks in advance!

3 comments

0

Clone seems like a cleaner solution to me. Also think about reusing older parts if you can.

0

All right. This is an answer in itself. Thank you!

0

When using clone watch out for http://wiki.roblox.com/index.php?title=API:Class/Instance/Archivable But for this kind of task its bets to use the method which is easiest to maintain regardless if there are any small efficiency gains.

2 answers

Well are you going to Delete the part at all? and is it going to be cloned alot of times?

I mean if i was you if i was cloning the part alot i would put it in server storage and :clone() it so i don't have to set alot of properties

but

if i was using it a few times and it was something important i'd Instance.new()

But that's just my thoughts

Always use Instance.new() instead of clone() when possible.

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