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 » Scripters
Home Search
 

Re: WaitForChild

Previous Thread :: Next Thread 
deadlyfox43110 is online. deadlyfox43110
Joined: 09 Oct 2009
Total Posts: 1823
02 Jul 2015 07:28 PM
How does one use this?
Is it even what I'm looking for?
I want the script to detect when five bricks are in place (in a different model) and then do something (that I know how to code).
Report Abuse
Marzlyn is not online. Marzlyn
Joined: 15 Jun 2014
Total Posts: 4431
02 Jul 2015 07:32 PM
repeat wait() until Bla bla and Bla bla

or you could create an array that checks stuff and if its there it inserts it into it
once the length of array (#Array) is 5 then it would work


-Baheeg
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
02 Jul 2015 07:35 PM
are the five bricks placed in their own separate models?
Report Abuse
deadlyfox43110 is online. deadlyfox43110
Joined: 09 Oct 2009
Total Posts: 1823
02 Jul 2015 07:41 PM
No, but that's not the problem.
When I move the bricks into the model that the script is checking, I want the script to activate another bit of that code (i.e. it'll blow up a brick or destroy a brick or whatever).

I want it to make sure that when all five bricks are in the model, something will happen.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
02 Jul 2015 07:44 PM
local specialParts = {}

model.ChildAdded:connect(function(child)
if child:IsA("Part") and child.Name == "SpecialPart" then
table.insert(specialParts, child)
if #specialParts == 5 then
-- stuff
end
end
end
Report Abuse
deadlyfox43110 is online. deadlyfox43110
Joined: 09 Oct 2009
Total Posts: 1823
03 Jul 2015 08:06 AM
09:05:40.642 - Workspace.Script:5: bad argument #1 to 'insert' (table expected, got nil)
Report Abuse
rubene45 is not online. rubene45
Joined: 08 May 2012
Total Posts: 333
03 Jul 2015 08:10 AM
You must add the name of the parts on the table to make the code runs...
Report Abuse
deadlyfox43110 is online. deadlyfox43110
Joined: 09 Oct 2009
Total Posts: 1823
03 Jul 2015 08:12 AM
Oh, my error.
Report Abuse
deadlyfox43110 is online. deadlyfox43110
Joined: 09 Oct 2009
Total Posts: 1823
03 Jul 2015 08:16 AM
Ok, it's working good now.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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