Clone (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>JulienDethurens No edit summary |
>JulienDethurens No edit summary |
||
Line 1: | Line 1: | ||
<onlyinclude>{{Method | <onlyinclude>{{Method | ||
|name = Clone | |name = Clone | ||
|returns = | |returns = {{type|Instance|RBX.lua.Instance (Object)}} | ||
|description = Returns a clone of the object, unless its [[Archivable]] property is false. The clone will have the same properties as the original object and the same descendants (except those with an [[Archivable]] property set to false). The clone's [[Parent]] will be [[nil]]. | |description = Returns a clone of the object, unless its [[Archivable (Property)|Archivable]] property is false. The clone will have the same properties as the original object and the same descendants (except those with an [[Archivable (Property)|Archivable]] property set to false). The clone's [[Parent (Property)|Parent]] will be [[nil]]. | ||
|object = Instance | |object = Instance | ||
}}</onlyinclude> | }}</onlyinclude> | ||
Line 18: | Line 18: | ||
==Objects that cannot be cloned== | ==Objects that cannot be cloned== | ||
When [[Archivable]] is set to ''false'' on an object, the game sees that as a temporary object that should not be involved in saving, nor cloning. When Clone creates the clone of an object and its descendants, any objects with the Archivable property set to false will not be included in the clone. For example, if a [[Model]] contains a [[Part]] whose Archivable property is set to false, when the model is cloned, the clone model will not contain a clone of the part. | When [[Archivable (Property)|Archivable]] is set to ''false'' on an object, the game sees that as a temporary object that should not be involved in saving, nor cloning. When Clone creates the clone of an object and its descendants, any objects with the Archivable property set to false will not be included in the clone. For example, if a [[Model]] contains a [[Part]] whose Archivable property is set to false, when the model is cloned, the clone model will not contain a clone of the part. | ||
This means that if Clone is called directly on a non-archivable object, it will return nil. | This means that if Clone is called directly on a non-archivable object, it will return nil. |
Revision as of 22:54, 12 February 2012
Clone( ) | |
Returns | RBX.lua.Instance (Object) |
Description: | Returns a clone of the object, unless its Archivable property is false. The clone will have the same properties as the original object and the same descendants (except those with an Archivable property set to false). The clone's Parent will be nil. |
Member of: | Instance |
Example
{{{1}}}
Objects that cannot be cloned
When Archivable is set to false on an object, the game sees that as a temporary object that should not be involved in saving, nor cloning. When Clone creates the clone of an object and its descendants, any objects with the Archivable property set to false will not be included in the clone. For example, if a Model contains a Part whose Archivable property is set to false, when the model is cloned, the clone model will not contain a clone of the part.
This means that if Clone is called directly on a non-archivable object, it will return nil.
Several classes of objects, such as Hats, the DataModel and services can never be cloned, and behave in the same way as a non-archivable object.
Example
{{{1}}}