|
| 11 Apr 2012 07:32 PM |
| I don't get Clone(). I don't get how you set it's parent to something. I even looked on Object Browser in Studio! I really need it for my game. Can someone explain Clone() to me? Maybe an example Script? |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2012 07:34 PM |
join party, il explain. :3
~Working towards that PSTF..~ |
|
|
| Report Abuse |
|
|
Techwiz19
|
  |
| Joined: 30 Jan 2011 |
| Total Posts: 462 |
|
|
| 11 Apr 2012 07:37 PM |
Usually, you set a variable as an object's clone Then the parent is where the clone goes
p = game.Workspace.Part:Clone() p.Parent = game.Workspace |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 11 Apr 2012 07:37 PM |
It takes everything that was cloned (For example, in a model, it would take all the parts and everything inside that), then parents it to nil. When you change it's parent to Workspace or wherever, it is added into the game so that you can interact with it.
This script creates a part, parents it to Workspace, clones it, then moves it into Workspace:
local part = Instance.new("Part", workspace) part.Name = "ThisIsBeingCloned"
print(part.Name) -- The original name
local clone = part:Clone()
print(clone.Name) -- As a clone, it will have the exact same properties; name, position, size, etc. print(clone.Parent)
clone.Parent = workspace print(clone.Parent) |
|
|
| Report Abuse |
|
|
Phellem
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 1984 |
|
|
| 11 Apr 2012 07:39 PM |
| object:clone().Parent = workspace |
|
|
| Report Abuse |
|
|