API:Class/Instance/Clone

Clone

Function of Object Icon.pngInstance
Ref<Instance> Clone ()

Returns: Ref<Instance>
Description: Returns a copy of the object, including descendants, but only if the object is Archivable.

Notes

  • The copy's Parent is initially nil.
  • Calling Clone on an object whose Archivable property is false returns nil.
  • If using Clone to copy a Model it is important to call MakeJoints on the clone as joints made via SurfaceTypes are not copied.

Example

local part = Instance.new("Part")
part.Parent = Workspace
 
local clone = part:Clone()
print(clone.Parent)
--> nil