What is a for I loop, how is it used?

What is a for i loop and what is it used for?

also what’s TweenService and How is it used?

The for loop you are mentioning is a numeric for loop, basically an increment/decremental loop, usually used if you need to do something for a specific amount of times

First number is the number the variable starts with, the 2nd number is the number it should end it or above, and an optional 3rd number is the step it adds/subtracts with

for i = 1, 5 do
    print(i)
end
--Prints 1, 2, 3, 4, 5

for i = 2, 10, 2 do
    print(i)
end
--Prints 2, 4, 6, 8, 10

TweenService is a service used to make a list of properties change from one to another smoothly, like making the Position of a part change smoothly from one position to another

2 Likes

For i = 1, 2 do
end

it basically repeats something until i is equal to 2

For more information go to the website:

2 Likes

Basically,
The “i” is the start amount. and the second number is how many times it will repeat the following stuff.
Here’s an example:

for i = 1, 10 do
print("This will be printed 10 times. This has been printed"..i.." times.")
end

As the script says, it would print that 10 times (And also it would print how many times it has done that)

TweenService is just a service that lets you smoothly change the properties of something. Like a mesh’s offset, part size, part transparency and other stuff.

The is a way to create endless loop , it’s very useful for starter

while wait(1) do–<Never put true at 1 it will crash
warn(“help”)
end

and there is also a way to break(stop) loops by

while wait(1) do–<Never put true at 1 it will crash
warn(“help”)
if true then
break
end
end

and there is also a way to continue(stop) loops by

while wait(1) do–<Never put true at 1 it will crash
warn(“help”)
if true then
warn(“is true continue”)
continue
end
end