|
| 18 Dec 2015 05:31 PM |
get a target (lets say it's a model) and get all of its children and then the names of the children get printed to text label.
So, getchildren of model.Text = name,name,name etc...
|
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 05:36 PM |
Something like this,
local children = {} local model = game.Workspace.Model:GetChildren() for _, v in pairs(model) do table.insert(children, v.Name) for i =1,#children do q = 1 script.Parent.Text = children[i]..children[i+(i + q)]..children[i+(i + q)] q = q + 1 end end
Wouldn't it be something like this?
Did you know the chance of you being born was 1 in 400 trillion? |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 05:40 PM |
| i've tried the script and nothing works, not even an output error. |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 05:41 PM |
Well, you need to set it up...
Did you know the chance of you being born was 1 in 400 trillion? |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 05:42 PM |
| So you're technically giving me a broken script..? |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 05:57 PM |
No.. I assumed you would know what the variables mean, and I assumed you would have set it up this way... If you wanted me to give you a spot on script, you would need to give me more specific details, as to where you plan on putting this script, and what your model name is, and where it is located.
Did you know the chance of you being born was 1 in 400 trillion? |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 05:59 PM |
I put the script inside the text label.
This is what i put for the line:
local model = game.Workspace.Conveyor:GetChildren()
Not working. No output. |
|
|
| Report Abuse |
|
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
|
| 18 Dec 2015 06:14 PM |
Good idea with the for loop, you want the script to run through all of the children of the model.
use the for i,v in pairs(model:GetChildren()) do --inside here, you can get the name of the child, with v.Name --then insert them all into a table with table.insert(table's name, child's name) end
then to get the list of names, use table.concat(table's name)
textlabel = table.concat(table's name)
or the wiki has it as table.concat(table's name, " ")
I don't want to give out the exact code. Think of it as a problem you have to solve. The problem solving part of scripting is what makes scripting so fun :) |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 06:19 PM |
| I want help, not a learning quiz, wtf is "concat". Not going to waste my time on "concat". |
|
|
| Report Abuse |
|
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
|
| 18 Dec 2015 06:25 PM |
concat takes a table and turns it into a list
table1 = {part1, part2, part3}
print(table.concat(table1, ""))
the output is: part1 part2 part3
so my guess, is if you put the names of all the children, and you set the textlable.text = to the table.concat(table1, "") it should put everything into the label |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 05:15 AM |
| To me, your talking gibberish, i asked how, not me figuring out how. I do not understand a single thing, and nowhere in this thread I asked for "fun" in scripting. |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 19 Dec 2015 06:05 AM |
"not me figuring out how" "nowhere in this thread I asked for "fun" in scripting"
great! thread over. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 06:15 AM |
^
I don't want fun in scripting, this sub-forum isn't anything about FUN. OMG, can I just have the sample script instead of some waste-of-time quiz that's technically asking me to do it myself.
A person attempted to do what i wanted but then the script didn't work, but then some kind of jigsaw puzzles came into the thread.
I do NOT want anyone starting this BS:
"A person attempted to do what i wanted but then the script didn't work, but then some kind of jigsaw puzzles came into the thread."
>Some comeback answer here
If a person did it within 3 minutes, anyone else that knows this can do it easily in 3 minutes, too! I do not see why you want to give me "fun" because i did not ASK fun. What you are asking is for FLAME. Now, no comebacks, replies to this very post. I want replies to thread.
What i'm simply asking for is:
- No fun - No puzzles - No brain teasers - The answer |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 06:48 AM |
| Don't be rude if you want people to help you. Learning means you won't have to be asking all these questions, try it like the rest of us have and stop complaining |
|
|
| Report Abuse |
|
|
Alpinu
|
  |
| Joined: 10 Jul 2010 |
| Total Posts: 108 |
|
|
| 19 Dec 2015 06:55 AM |
names = {}
function getChildNames(model) for _,v in pairs(model:children()) do table.insert(names,v.Name) getChildNames(v) end return names end
function giveNamesOf(model) names = {} return table.concat(getChildNames(model)) end
Whatever.Text = giveNamesOf(workspace)
--now take it and get out. This subforum is for people whom appreciate scripting, not selfish jerks. Just go and don't say anything more if you wish to not look like a fool. |
|
|
| Report Abuse |
|
|
Auzer
|
  |
| Joined: 24 Dec 2011 |
| Total Posts: 1590 |
|
|
| 19 Dec 2015 07:05 AM |
function PrintChildren(Model) Children = {} for i = 1, #Model do table.insert(Children, Model[i].Name) end return table.concat(Children, " | ") end |
|
|
| Report Abuse |
|
|
Alpinu
|
  |
| Joined: 10 Jul 2010 |
| Total Posts: 108 |
|
|
| 19 Dec 2015 07:08 AM |
| Yours ain't recursive like mine, mate. Fight me :^) |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 08:03 AM |
| what if i wanted to access the players? |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 08:06 AM |
| Methinks you'd have to use your brain - The people here have already made it quite clear that they're not going to wipe your ass for you. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 08:09 AM |
| I needed to use :WaitForChild(), that's why i couldn't get the players. Thanks anyways. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 08:32 AM |
| Aviator, you ungrateful spoiled ass kid. Shut the hell up and figure something out for once, not everything will be handed to you on a silver platter. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 07:51 PM |
Okay, if you set this up right it will work.
local TextLabel = script.Parent local Contents = {} local Model = game.Workspace.Conveyor:GetChildren() while wait() do for _, v in pairs(Model) do table.insert(Contents, v.Name) end TextLabel.Text = unpack(Contents) end
Did you know the chance of you being born was 1 in 400 trillion? |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2015 04:11 PM |
would it be possible too.. only list the names if the child's parent is the target? E.g
script.Parent.Text = Tool
But not script.Parent.Text Tool>>Handle Script Mesh
etcc |
|
|
| Report Abuse |
|
|