I have seen this quite a few times but I do not know what it means.Any help?
i,v in pairs is used for sorting through a table. For example:
local tab = {'help'} for position,value in pairs (tab) do print('The value in the table, '..value..' is in position '..tostring(position)) end
This script shows all the values in the table and their position.
When you do :GetChildren() on an object, it returns a table of the children. To sort through the children of an object, you would do this:
for position,child in pairs (workspace:GetChildren()) do print('There is an object in workspace named '..child.Name..' and a position of '..tostring(position) end
You can change position and child to any variable you desire, for example, i and v.
I hope this helps you!
When using for i,v in pairs, it can get all children in any object.
For Example:
for i,v in pairs(game.Workspace:GetChildren()) do v.Transparency = 0.5 end
Basically, this iterates through the children of an instance given in the parameters.
for i, v in pairs(Example:GetChildren()) do --code end
The first value, i stands for index, and is essentially which iteration it is currently on and v is the current instance. For example, let's say Example is a model with 3 parts in it, and i wanted to make them all transparent:
for i, v in pairs(Example:GetChildren()) do v.Transparency = 1 print(i) --This will output which part we are currently 'editing' end
Each brick will become transparent, and for each one it will print respectively, 1, 2 and 3. For a more detailed answer, go to the link aazkao helpfully provided for you.