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

My rocket moves to the desired increment, but the rest become 1 stud increments?

Code I have so far:

for b = 10,100 do 
            game.Workspace.Rocket:MoveTo(Vector3.new(38, 67.171+b, -168.25))
            wait(0.5)
        end

So when my rocket is launched, the very first increment is 10. After that increment of movement is done, it goes on to be 1 increment movements! This is my first time using for loops, could someone help me with the problem?

1 answer

✓ Accepted answer

For loops work like this:

for [Starting Value], [Last Value], [Optional: Number of increment, if not defined, it will be 1 by default]

The loop will go until the Starting Value will reach the Last Value and the Starting Value will be increased by the Optional Value or 1 if not defined.

So by saying: for b = 10,100 do the B value will start at 10 and will increase by 1 (as you didn't define optional value) which means when you add B for the first time to 67 it will be 77 and the next time it will be 78 as B was increased by 1 which means it changed from 10 to 11. For example: If you want to be increased by 10 each time you need to for b = 10,100, 10 do

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