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
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
| |
|
|
| 26 Dec 2013 07:16 PM |
| Yes. Selects all children within a group. |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2013 07:24 PM |
| Then you are doing something wrong |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 26 Dec 2013 07:25 PM |
| @cnt Yeah, he probably has some other error in his script. |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2013 07:25 PM |
| I'm sorry, is holder even legit, I've never used that. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 26 Dec 2013 07:27 PM |
| just do script:getchildren() then lol |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
| |
|
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
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|