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
 

Get Children then Clone Children

Previous Thread :: Next Thread 
Aerolus is not online. Aerolus
Joined: 05 Sep 2011
Total Posts: 847
13 Oct 2013 09:09 AM
Hey, I'm having some issues with cloning the children of a model in Lighting into a model in Workspace.

game.Lighting["Obby"]:Clone().Parent = game.Workspace.moved
--this is just fine

How would I GetChildren of "Obby" and move it into "game.Workspace.moved"?
Report Abuse
mic144 is not online. mic144
Joined: 14 Oct 2009
Total Posts: 1598
13 Oct 2013 09:22 AM
If Obby is a model I suggest you move the entire model.

But here:

obbyp = game.Lighting:findFirstChild("Obby")
for _, v in pairs(obbyp:getChildren()) do
if v:IsA("Part") or v:IsA("Wedge") or v:IsA("Truss") then
v.Parent = workspace.moved

end
end

You might want to move them back because I didnt clone them for you.
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
13 Oct 2013 09:22 AM
"if v:IsA("Part") or v:IsA("Wedge") or v:IsA("Truss") then"
if v:IsA("BasePart") then
Report Abuse
Aerolus is not online. Aerolus
Joined: 05 Sep 2011
Total Posts: 847
13 Oct 2013 09:23 AM
When I try to clone the children its treating Clone like a nil value here:

game.Lighting["Obby"]:GetChildren():Clone().Parent = game.Workspace.moved
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
13 Oct 2013 09:24 AM
:GetChildren() returns a table
You`re trying to clone something like this
table = {Part1,Part2,Part3}
See the problem?
Report Abuse
Aerolus is not online. Aerolus
Joined: 05 Sep 2011
Total Posts: 847
13 Oct 2013 09:24 AM
I know how to move the entire model, but if I move it into the model in Workspace then I'd want to ungroup it. In the place there would be several models in the model in Workspace which wouldn't run how it should, it needs to be individual parts.
Report Abuse
BombEater25 is not online. BombEater25
Joined: 04 Jan 2013
Total Posts: 136
13 Oct 2013 09:24 AM
--nonononononono..

local children1
game.Lighting.Obby:GetChildren()
children1.Parent = game.Workspace.moved
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
13 Oct 2013 09:24 AM
function GetParts(Model)
for i,v in pairs(Model:GetChildren()) do
if v:IsA("BasePart") then
v:clone().Parent=game.Workspace
else
GetParts(v)
end
end
end

GetParts(game.Lighting.Obby)
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
13 Oct 2013 09:26 AM
Okay aeroulus, my script gets EVERY descendant that's a part and seperates it, so you don't have to ungroup stuff in lighting or anything.
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