Clone (Function): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Mr Doom Bringer No edit summary |
>Mr Doom Bringer No edit summary |
||
Line 1: | Line 1: | ||
{{CatUp|:Category:Functions}} | {{CatUp|:Category:Functions}} | ||
The Clone function creates a duplicate of an object. You have to | The Clone function creates a duplicate of an object. You don't have to set it to a variable | ||
{{Function| | {{Function| | ||
Line 12: | Line 12: | ||
==Example== | ==Example 1== | ||
This example creates a copy of a car every 5 minutes, and gives the new car a silly name. | This example creates a copy of a car every 5 minutes, and gives the new car a silly name. | ||
Line 30: | Line 30: | ||
end | end | ||
</pre> | |||
==Example 2== | |||
This example simply creates an instant copy of the original model. | |||
<pre> | |||
game.Workspace.Model:Clone.Parent = game.Workspace | |||
</pre> | </pre> |
Revision as of 19:22, 25 March 2010
[[::Category:Functions|Up one category:
:Category:Functions]]
:Category:Functions]]
The Clone function creates a duplicate of an object. You don't have to set it to a variable
Clone( ) | |
Returns | Instance object |
Description: | Returns a copy of this Object and all its children. The copy's Parent is nil |
Example 1
This example creates a copy of a car every 5 minutes, and gives the new car a silly name.
while true do --Starts up a While loop model = game.Workspace.Car:Clone() --This line creates a copy of "Car" in the Workspace. --Since we set it to "model" we can do things with it. model.Name = "LOLZCARLOLOLOLOL" --Here we set the name of the Model to something silly. --But the model is just a variable, not an object. --For that we need to set it's parent. model.Parent = game.Workspace --Now we make it appear in the game world. wait(300) --Wait 300 seconds, or about 5 minutes. end
Example 2
This example simply creates an instant copy of the original model.
game.Workspace.Model:Clone.Parent = game.Workspace