How would i make a script that would get tools from ReplicatedStorage and put them in the table?
✓ ANSWER ACCEPTED
How do i put tools from replicatedstorage in a table?
2 answers
✓ Accepted answer
GetChildren
GetChildren is one of many inherited members of the Instance base class (see here), which means you can call it on any ROBLOX object. This method will return a table (specifically, an array or list), of all the children inside the object you called it on. Here's an example:
local RepStorage = game:GetService("ReplicatedStorage") -- Get service
local RepStorageContents = RepStorage:GetChildren() -- Call GetChildren on service
-- Iterate through the contents GetChildren returned, printing out their individual names.
for k, v in pairs(RepStorageContents) do
print("Index:", k, "Object:", v)
end
If you're confused about anything, just leave a comment letting me know; I'll respond as soon as possible.
local Tools = game:GetService('ReplicatedStorage')
tools = {}
Tools.ChildAdded:connect(function(Child)
if Child:IsA("Tool") then
table.insert(tools, Child.Name)
print('Inserted tool name into table')
end
end)
NOTE Another script is required to use this.
wait(1)
local tool1 = game.TOOLPLACE
local tool2 = game.TOOLPLACE
wait(1)
tool1.Parent = game:GetService('ReplicatedStorage')
tool2.Parent = game:GetService('ReplicatedStorage')
NOTE Do not put tools in replicated storage.
If this is not what you looked for sorry. And I know there is a easier way of doing this, this is my personal way to go.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Is there a way that I could put each of the individual names into textboxes?
Yes. The list contains all of the objects inside the object you called the method on. You can iterate this list like I have in my sample code, access these objects individually, and do whatever you like with them.
Thx for the help :)
How would I print out their individual names?