Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

For i, v problem?

for i, v = 0.1, -1 do
	-- Code goes here, but I can't figure out how to make it do like for example i, and v. Into one.
end 

I do that, and it errors.

1 comment

0

Umm...try re-wording your question, this is kind of difficult to understand.

1 answer

✓ Accepted answer

There are two types of for loops.

The numeric for loop goes over a range of numbers. It looks like this:

for count = start, stop do

The generic for loop uses an iterator to generate a bunch of values. It looks like this:

for a, b, c, d in expr do

If you're using a numeric for loop, there's only one variable.

for i = 0.1, -1 do

It will step by 1 however -- and -1 is smaller than 0.1 so your loop won't do anything at all. You need to specify how much you step by, the third thing:

for i = 0.1, -1, -0.1 do

This will use i as 0.1, 0, -0.1, -0.2, ..., -0.9, -1

This discussion is preserved as it was. New answers, comments, and votes are closed.