How to fix this?Help!

These are the coordinates
coordinates2
so there are 2 things in the folder 1 is sword and other one is bow fine.
noproblem

noproblem2

but when i bracket it it comes like this

problem

problem2
it comes one ,but there are 2 things in da folder but it only shows one thing ,Why? and How to fix this code?

I don’t understand the issue, what are you trying to achieve exactly?

In the 4th pic, i made it in brackets
but it prints 1 children but as you can see from the first pic there are 2 children

its not being looped second time

Why did you add curly brackets?

1 Like

because foor example to get something from a table u need to table[1 or 2 or blah blah blah]
but in
for i,v in pairs
its has to be in { }
so that i could get this thing v[1]

That’s because when you use brackets, You’re telling the pairs() function that it is a table. Plus, You also added the :GetChildren() inside the table, Which will only loop through the first Child of the Folder.

local folder = game.Workspace.Folder

for i,v in pairs(folder:GetChildren()) do
 -- stuff
end

local folder = game.Workspace.Folder

for i,v in pairs(folder:GetChildren()) do
print(v[1].Name)
end

can u tell me what error you will get in output

The v in the for i,v loop stands for value, you can’t index it like an array by doing [1], the in pairs loop runs 1 time for every child inside the folder you provided (the array), remove the [1], v.Name will return “Bow” and “Sword”.

1 Like

i get this.so how to fix this .gimme solution
that thing

Can you show your script, the script which is returning the error?

2nd line
eeeeeeeee

for i,v in pairs(game.Workspace.Folder:GetChildren()) do
    print(v.Name)
end
local folder = game.Workspace.Folder
local Table = {}

for i,v in pairs(folder:GetChildren()) do
    table.insert(Table, v)
end
1 Like