I recently saw that Instance had a new constructor and I’m not really sure what it does. The documentation said it worked very similar to Instance:Clone(), so do I need to use it? What exactly is the purpose of this? In what cases would I use this?
Thank you for your answers and have a wonderful day!
@tnavarts could likely shed some better light on its exact purpose, but from what I understand, it’s for convenience when you need to clone an Instance without its children (which could lead to some performance gains)
Thanks for the answer! I wasn’t sure if it was better for performance or not, but now I know! If I have any further questions, I’ll ask @tnavarts. Have a wonderful day!
Creates a new object with the same type and property values as an existing object. In most cases using Instance:Clone() is more appropriate, but this constructor is useful when implementing low‑level libraries or systems.
For example, if you were implementing a custom streaming solution for your experience you might want to partially clone objects using fromExisting.
You probably want good ol’ Clone almost all the time, fromExisting is intended for use by authors of low level library code who need more control over how stuff is cloned.
Like, general systems rather than specific game logic. If I go to the trouble of writing a custom streaming system I’m probably going to re-used it across several different games, with the code in that streaming system not knowing any details about the individual games.