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
 

Tips about the WaitForChild() call!

Previous Thread :: Next Thread 
DesignerDavid is online. DesignerDavid
Joined: 18 Feb 2014
Total Posts: 8422
14 Aug 2015 06:57 PM
WaitForChild does not listen to name changes of existing children. For example, if a script calls Workspace:WaitForChild("Brick") and a part in Workspace is renamed from Part to Brick, the method will continue waiting.

Another example, the code waits for an instance in the Workspace named "Block". If the instance is not in the Workspace, this code will just keep waiting.

local part = Workspace:WaitForChild("Block")
print(part.Name .. " has been added to the Workspace")

So if you think something is wrong with the script, you don't see errors in the output, and you're using WaitForChild, you might want to check on that variable or whatever you're using WaitForChild on.

Hope this has been helpful!
Report Abuse
cntkillme123 is not online. cntkillme123
Joined: 10 Feb 2013
Total Posts: 539
14 Aug 2015 07:00 PM
'WaitForChild does not listen to name changes of existing children'
I thought this was changed?
Report Abuse
WolfgangVonPrinz is not online. WolfgangVonPrinz
Joined: 24 Oct 2013
Total Posts: 4656
14 Aug 2015 07:03 PM
So cnt is back... kk

Women are like fine wine, I can't get their tops off
Report Abuse
FactualTheory is not online. FactualTheory
Joined: 10 Sep 2013
Total Posts: 1365
14 Aug 2015 07:04 PM
why is dev in ur name.

obvs a dud
Report Abuse
cntkillme123 is not online. cntkillme123
Joined: 10 Feb 2013
Total Posts: 539
14 Aug 2015 07:04 PM
I've been back
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
14 Aug 2015 07:50 PM
"WaitForChild does not listen to name changes of existing children. "

Yes it does.

Well as of last week
Report Abuse
cycoboy83 is not online. cycoboy83
Joined: 31 May 2011
Total Posts: 831
14 Aug 2015 08:05 PM
Decided to test this in the name of science! Using 2 scripts in ROBLOX Studio:

Script 1:
wait(2)
print("Spawning part")
local part = Instance.new("Part",Workspace)
print("Renaming part")
part.Name = "Bleh"

Script 2:
print("Beginning wait")
Workspace:WaitForChild("Bleh")
print("We gotz a bleh!")

Output:
Beginning wait
Spawning part
Renaming part
We gotz a bleh!

So the people who have posted before me are correct. WaitForChild will listen for name changes and react accordingly.
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