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: Trying to get children of added object

Previous Thread :: Next Thread 
LetterSlayer is not online. LetterSlayer
Joined: 02 Aug 2010
Total Posts: 946
05 Aug 2016 12:47 PM
game.Workspace.ChatHandler.DescendantAdded:connect(function(Obj)
if Obj:IsA("Folder") then
for _, Thing in pairs(Obj:GetChildren()) do
print(Thing.Name)
end
end
end)
I've tried :FindFirstChild and :WaitForChild, neither work.. and this doesn't print, any ways to solve this? Bit confused and frustrated.


ERROR YOU DIVIDED BY ZERO. ZERO. 0. THIS IS BAD. The world is now ending because of you!
Report Abuse
LetterSlayer is not online. LetterSlayer
Joined: 02 Aug 2010
Total Posts: 946
05 Aug 2016 01:25 PM
Bump


ERROR YOU DIVIDED BY ZERO. ZERO. 0. THIS IS BAD. The world is now ending because of you!
Report Abuse
LetterSlayer is not online. LetterSlayer
Joined: 02 Aug 2010
Total Posts: 946
05 Aug 2016 02:14 PM
Bump


ERROR YOU DIVIDED BY ZERO. ZERO. 0. THIS IS BAD. The world is now ending because of you!
Report Abuse
LetterSlayer is not online. LetterSlayer
Joined: 02 Aug 2010
Total Posts: 946
05 Aug 2016 03:16 PM
Am I missing something? Not enough info? Someone?


ERROR YOU DIVIDED BY ZERO. ZERO. 0. THIS IS BAD. The world is now ending because of you!
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
05 Aug 2016 03:16 PM
obj:GetChildren() == array of children == {child,child,child..}

for _,v in pairs(obj:getChildren()) do
--v is a child
end



if you know this then that is not what you did wrong.
Report Abuse
LetterSlayer is not online. LetterSlayer
Joined: 02 Aug 2010
Total Posts: 946
05 Aug 2016 03:19 PM
Uh? It doesn't do anything... I thought you could just do :FindFirstChild.. but that doesn't even work..


ERROR YOU DIVIDED BY ZERO. ZERO. 0. THIS IS BAD. The world is now ending because of you!
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
05 Aug 2016 03:22 PM
Maybe try using ChildAdded on where the folders will be
Report Abuse
LetterSlayer is not online. LetterSlayer
Joined: 02 Aug 2010
Total Posts: 946
05 Aug 2016 03:27 PM
The objects I'm trying to access are already in the folder when it's added though.


ERROR YOU DIVIDED BY ZERO. ZERO. 0. THIS IS BAD. The world is now ending because of you!
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
05 Aug 2016 03:30 PM
Not what I meant -.-

folderLocation.ChildAdded:connect(function(folder)

end)

You can literally also just make another folder or a model where all folders will go
Report Abuse
Noveric is not online. Noveric
Joined: 04 Aug 2016
Total Posts: 432
05 Aug 2016 03:32 PM
This will work fine - it's an issue with the folder.


Report Abuse
LetterSlayer is not online. LetterSlayer
Joined: 02 Aug 2010
Total Posts: 946
05 Aug 2016 03:33 PM
You're confusing me though.. that's what DescendantAdded does.. I'm trying to keep this compact, not spread about in 4 different folders, that creates clutter and complicates things. That should work, but nothing happens.


ERROR YOU DIVIDED BY ZERO. ZERO. 0. THIS IS BAD. The world is now ending because of you!
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
05 Aug 2016 03:34 PM
^ It is much easier to keep all messages organized in 1 folder than to see which child is a folder
Report Abuse
LetterSlayer is not online. LetterSlayer
Joined: 02 Aug 2010
Total Posts: 946
05 Aug 2016 03:35 PM
But it's like 2 lines of code to see if it's a folder that's being added.. I'm trying to keep 4 values together, not spread apart.


ERROR YOU DIVIDED BY ZERO. ZERO. 0. THIS IS BAD. The world is now ending because of you!
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
05 Aug 2016 03:37 PM
function FolderAdded(f)

end

script.Parent.ChatFolders.ChildAdded:connect(FolderAdded)

--much easier
--also before parenting the folder to it you need to fill it
Report Abuse
LetterSlayer is not online. LetterSlayer
Joined: 02 Aug 2010
Total Posts: 946
05 Aug 2016 03:38 PM
Oh my god, that was my problem.. don't know how I didn't find that myself, thanks.. even though I sound like a smart ass...


ERROR YOU DIVIDED BY ZERO. ZERO. 0. THIS IS BAD. The world is now ending because of you!
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
05 Aug 2016 03:39 PM
If you do

local f = Instance.new("Folder",chatstuff)

then it will read the empty folder
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
05 Aug 2016 04:18 PM
workspace.ChatHandler.ChildAdded:connect(function(child)
if child:IsA('Folder') then
for i,v in next, child:GetChildren() do
print(v.Name)
end
end
end)


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