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: WaitFor Multiple Parts

Previous Thread :: Next Thread 
drtbik12 is not online. drtbik12
Joined: 22 Jun 2011
Total Posts: 85
07 Sep 2013 09:56 PM
How do you do it? :o
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
07 Sep 2013 09:56 PM
What?
Report Abuse
drtbik12 is not online. drtbik12
Joined: 22 Jun 2011
Total Posts: 85
07 Sep 2013 09:58 PM
Like model:WaitForChild("Part"), but for multiple parts.
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
07 Sep 2013 09:59 PM
object:WaitForChild("SomeObjectName")
player.Character:WaitForChild("Torso")

Something like that?
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
07 Sep 2013 09:59 PM
Multiple parts of the same name? If that's so, you might need to know the number of parts you are expecting.
Report Abuse
drtbik12 is not online. drtbik12
Joined: 22 Jun 2011
Total Posts: 85
07 Sep 2013 10:02 PM
In the same line, I think it's something like this: model:WaitForChild("Part1","Part2") :D
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
07 Sep 2013 10:02 PM
Just make a custom function :0.

function waitFor(Parent,...)
local Args = {...}
wait()
local Okay = true
for _,n in ipairs(Args) do
if not Parent:FindFirstChild(n) then
Okay = false
end
end
if Okay then return end
waitFor(Parent,Args)
end

waitFor(Workspace,"Hi","Bob")
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
07 Sep 2013 10:04 PM
script.Parent:WaitForChild("Part", "Part1")
Im not sure if this will work, i dont use WaitForChild alot.
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
07 Sep 2013 10:05 PM
It would be nice if it still returned the list of objects you were waiting for though:

function WaitForChildren(parent, ...)
local children = {}
for _,n in pairs{...} do
table.insert(children, parent:WaitForChild(n))
end
return unpack(children)
end

local obj1, obj2, obj3 = WaitForChildren(game.Workspace, "BasePlate", "Camera", "Terrain")
Report Abuse
drtbik12 is not online. drtbik12
Joined: 22 Jun 2011
Total Posts: 85
07 Sep 2013 10:13 PM
Thank you :D
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