So basically im still confused on for i loops. All I know is that I can use it for mutiple part event using tables. Im familiar with this type of for i loop:
for i, some in pairs(something)
but not this :
for i = some - idk
So can anybody show me how to do it? If its just a simple explanation, im fine with that
for loops are numeric loops, but ipairs loop is a loop which loop through table of instances
example
for number = 1, 5, 1 do print(number) end
output:
1 2 3 4 5
the first number in there is the minimum value, 1
second number is 5, which is the maximum value
you can think them as start and end
the third number is how many number skips per loop, default is 1, if you put something that is like for number = 1, 5, 6 do
it will not run, since it does not meet the requirement, formula is
(secondNumber - firstNumber) / thirdNumber = math.floor(howManyTimeItLoops)
for i, v in pairs / ipairs loop are instances loop like loop through an table of instances, well GetChildren returns a pair of table of the instance children, so we can do
for number, theChildrenThatIsDefinedOnLoop in ipairs(game.Workspace:GetChildren()) do print(theChildrenThatIsDefinedOnLoop.Name .." is the ".. number .."st/nd/rd/th children" end
it basically scans through children and print the currently scanning/ defined children value
if you dont understand, i think i will explain more since I HAVE HOMEWORK SO im in a candy rush moment byebye