Creates a copy of an instance and its all child objects with all the same property values. Set its Parent after cloning. Otherwise, the parent will be WorkSpace by default.
The references to all other objects that are not in the cloned structure will be preserved. The internal references in the cloned structure are relative, that is, if an internal object is referenced in the cloned object, a similar internal object will be referenced in the cloned copy.
By storing original copies and producing copies, Clone is very useful in rebuilding meshes. If the current status of a mesh changes, Clone may also be used to store the current status of the mesh.
|RWObject||Return a new object copy with the same properties as the original object.|
Create a part and clone a copy of the part.
local temp = RWObject.Create("Part") -- create an instance object of Part temp.Position = Vector3.New(2,2,2) -- set the coordinates of the instance object temp.Parent = WorkSpace -- set the parent of the created object as WorkSpace local temp1 = temp:Clone() -- create a copy of the part temp1.Position = Vector3.New(3,3,3) -- set the coordinates of the copy object temp.Parent = WorkSpace -- set the parent of the copy object as WorkSpace