Clone (Function): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>GoldenUrg
limitations
>Anaminus
No edit summary
Line 6: Line 6:
|returns              = [[Instance]] object
|returns              = [[Instance]] object
|description          = Returns a copy of this Object and all its children. The copy's Parent is nil
|description          = Returns a copy of this Object and all its children. The copy's Parent is nil
|object              = Global
|object              = [[Instance]]
|}}</onlyinclude>
|}}</onlyinclude>
|}
|}
 
==Description==
==Example==
{{Example|
<pre>
 
while true do
model = game.Workspace.Model:clone()
model.Parent = game.Workspace
wait(300)
end</pre>
==or==
<pre>
<pre>
 
local Model = game.Workspace.Model
while true do
while true do
game.Workspace.Model:Clone().Parent = game.Workspace
    local ModelCopy = Model:Clone()
wait(300)
    ModelCopy.Parent = game.Workspace
end</pre>
    wait(300)
 
end
which does the same thing
</pre>
}}


== Limitations ==
== Limitations ==
Objects with [[Archivable (Property)|archivable]] set to false are not cloned.
Objects with their [[Archivable (Property)|archivable]] property set to false are not cloned.


These classes are known to be unclonable: [[RBX.lua.Hat (Object)|Hats]], [[Workspace]]
The following classes cannot be cloned:
*[[RBX.lua.Hat (Object)|Hat]]
*[[Workspace]]

Revision as of 22:41, 24 October 2010

Clone( )
Returns Instance object
Description: Returns a copy of this Object and all its children. The copy's Parent is nil

Description

Example
local Model = game.Workspace.Model
while true do
    local ModelCopy = Model:Clone()
    ModelCopy.Parent = game.Workspace
    wait(300)
end


Limitations

Objects with their archivable property set to false are not cloned.

The following classes cannot be cloned: