generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: I need help understanding Clone().

Previous Thread :: Next Thread 
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
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
callmeduck2 is not online. callmeduck2
Joined: 18 Jan 2010
Total Posts: 2804
11 Apr 2012 07:34 PM
join party, il explain. :3

~Working towards that PSTF..~
Report Abuse
Techwiz19 is not online. 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 is not online. 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 is not online. Phellem
Joined: 04 Aug 2011
Total Posts: 1984
11 Apr 2012 07:39 PM
object:clone().Parent = workspace
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image