How do you copy a brick and plac eit somewhere else? I'm building a game that has to clone a brick and put it in the position (-33, 6.59, -35). How do you write out a function that will clone the Brick and place it in that position? Let me know. Thanks.
clone
is a method of any Instance.
Methods are called using :
as opposed to .
.
The Clone
method returns a copy of an instance and its descendants, excluding any objects with an Archivable
property set to false.
For example,
copy = workspace.Model:Clone();
This copy
however is only immediately parented to nil
and so won't appear.
copy.Parent = workspace;
Note that surfaces like studs / inlets will not automatically join for newly created parts. You must tell ROBLOX to MakeJoints
on the model to accomplish that:
copy:MakeJoints();
Note that all properties are copied between the original and copy. This includes position, so the model will be placed in exactly the same space that the original was, unless you move the cloned copy
yourself (for Models, you can use MoveTo
)