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

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

Asked by
Irunui 15
7 years ago

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!

0
Clone seems like a cleaner solution to me. Also think about reusing older parts if you can. evaera 8028 — 7y
0
All right. This is an answer in itself. Thank you! Irunui 15 — 7y
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. User#5423 17 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

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

Ad
Log in to vote
0
Answered by
nc2r 117
4 years ago

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

Answer this question