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: ChildAdded

Previous Thread :: Next Thread 
mu6666mu is not online. mu6666mu
Joined: 09 Apr 2012
Total Posts: 952
13 Jul 2013 12:55 PM
How would you write a script that checks if a Child was Added Period, not to just to one item, but any item?
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
13 Jul 2013 12:57 PM
Use DescendantAdded (if I'm understanding your question correctly...)
Report Abuse
mu6666mu is not online. mu6666mu
Joined: 09 Apr 2012
Total Posts: 952
13 Jul 2013 01:02 PM
ChildAdded is almost the same, but what I am trying to do is create a Plugin that removes the "print 'Hello world!'" in scripts but, I need to make it check if a script was added to anything at all.
Report Abuse
RoyStanford is not online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
13 Jul 2013 01:03 PM
workspace.ChildAdded:connect()

Be careful with this, you'll want to put a long before it because when the game loads lots of children are added so it makes the game lag and maybe crash
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
13 Jul 2013 01:05 PM
Then Nate got it.

Workspace.DescendantAdded:connect(function(Child)
if not Child:IsA("BaseScript") then return end
--Code
end)
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
13 Jul 2013 01:06 PM
Can't spell for my life:

Workspace.DescendantAdded:connect(function(Child)
if not Child:IsA("BaseScript") then return end
--Code
end)
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
13 Jul 2013 01:07 PM
ChildAdded is completely different :P. Do you know what DescentAdded does? Pretty sure it does what you want it to do... I'd link you a page on the wiki but there are none.

workspace.DescentAdded:connect(function(descent)
 print(decent.. " is now a child of ".. decent.Parent)
end)
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
13 Jul 2013 01:07 PM
@Nate ?

http://wiki.roblox.com/index.php/API:Instance/DescendantAdded
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
13 Jul 2013 01:09 PM
DESCENTANDADDED... LOL dang I'm rusty,
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
13 Jul 2013 01:10 PM
descendantadded***
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
13 Jul 2013 01:11 PM
Funny how I started saying in the post "DescendantAdded" then i searched the wiki for "DescentAdded" and I couldn't find it, and then I even used "DescentAdded" in my code.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
13 Jul 2013 01:13 PM
Haha, I couldn't spell it too. :P
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
13 Jul 2013 01:14 PM
I haven't coded in a long time.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
13 Jul 2013 01:15 PM
Wait a minute. . . What the heck, I did spell it right the first time. . . They're the same. o.e
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
13 Jul 2013 01:16 PM
It's a sneaky term.
Report Abuse
Tomarty is not online. Tomarty
Joined: 08 Dec 2008
Total Posts: 591
13 Jul 2013 01:51 PM
If you wanted to check all of the scripts in game at any point in time you could use a recursive function:
function Search(obj)
if not obj then return end
if obj:IsA("BaseScript") then
-- Goodies
end
for _, child in pairs(obj:children() ) do
Search(child)
end
end
Search(game)
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