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: can I do script:GetChildren() ?

Previous Thread :: Next Thread 
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
26 Dec 2013 07:16 PM
would it get all the objects inside the script?
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
26 Dec 2013 07:16 PM
It should.
Report Abuse
VesperoBLOX is not online. VesperoBLOX
Joined: 10 Nov 2013
Total Posts: 88
26 Dec 2013 07:16 PM
Yes. Selects all children within a group.
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
26 Dec 2013 07:23 PM
it does not work. I tested it. The script will not get the stuff inside of it.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Dec 2013 07:24 PM
Then you are doing something wrong
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
26 Dec 2013 07:24 PM
function loadtools()
if game.workspace.gme.Value==true then
tools=script.Parent.Holder:GetChildren()
for i=1,#tools do
print(tools[i].Name)
if tools[i].className=="Tool" or tools[i].className=="HopperBin" then
if script.Parent.Parent.BackPack:findFirstChild(tools[i].Name)==nil then
tools[i]:Clone()
tools[i].Parent=script.Parent.Parent.BackPack
end
end
end
end
end

game.workspace.gme.Value.Changed:connect(loadtools)


---reads no error. It just will not clone the tools inside the script and put it into the persons backpack.
Report Abuse
VesperoBLOX is not online. VesperoBLOX
Joined: 10 Nov 2013
Total Posts: 88
26 Dec 2013 07:25 PM
@cnt Yeah, he probably has some other error in his script.
Report Abuse
VesperoBLOX is not online. VesperoBLOX
Joined: 10 Nov 2013
Total Posts: 88
26 Dec 2013 07:25 PM
I'm sorry, is holder even legit, I've never used that.
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
26 Dec 2013 07:26 PM
holder is the script XD

basically what it's saying is script:GetChildren()
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
26 Dec 2013 07:26 PM
for i,v in pairs(game.Workspace.ScriptName:GetChildren()) do
-- stuff
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
26 Dec 2013 07:27 PM
just do script:getchildren() then lol
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
26 Dec 2013 07:28 PM
If you're going to index Workspace directly, capitalize it correctly
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
26 Dec 2013 07:29 PM
@lol workspace has always worked for me in the lowercase

@ the dude with the for i,v in pairs

--the holder is in the player's startergear
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
26 Dec 2013 07:30 PM
ash hes dumb
Report Abuse
thetacah is not online. thetacah
Joined: 18 Jan 2013
Total Posts: 16026
26 Dec 2013 07:30 PM
Yup, if anything is in the script, you should be able to say that with no problem.
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
26 Dec 2013 07:30 PM
Backpack not BackPack
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
26 Dec 2013 07:34 PM
thanks lol

That made something work. However, now all that is being cloned is the script; nothing else even though there is a tool in the script and only hopperbins and tools are allowed to be in the backpack.
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
26 Dec 2013 07:35 PM
if tools[i].className=="Tool" or tools[i].className=="HopperBin" then
if script.Parent.Parent.Backpack:findFirstChild(tools[i].Name)==nil then
tools[i]:Clone()
tools[i].Parent=script.Parent.Parent.BackPack


---I have these in there to prevent the script from cloning it self but it ends up cloning itself and putting nothing but itself in the backpack D:
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
26 Dec 2013 07:41 PM
I'll get back to you guys If I still can't fix it.
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
26 Dec 2013 07:49 PM
Ok so i gave up on that strategy. Instead I have a leaderboard make a model of the person's name. When they buy something the tool goes into their workspace backpack--wait -.-(fix lator :D)

the game script loads each players tools. hope it works.
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
26 Dec 2013 08:08 PM
tools[i]:Clone()
tools[i].Parent=script.Parent.Parent.BackPack

--This is the problem

Should be
tools[i]:clone().Parent = script.Parent.Parent.Backpack
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
26 Dec 2013 08:09 PM
game.workspace.gme.Value.Changed:connect(loadtools)

Also this line
should be
game.workspace.gme.Changed:connect(loadtools)
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
26 Dec 2013 08:12 PM
@wazap either way for the event connection; both works.

My new way works =D. Thanks for helping though.
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