I can't help but wonder if for loops can go backwards. Let me show an example with my code here.
part = script.Parent
function sum(x, y, z)
for i = 1, 10 do
part.Position += Vector3.new(x, y, z)
wait(0.01)
end
end
while true do
sum(1, 0, 0)
sum(-1, 0, 0)
end
I figured that if this for loop reaches its end/max value, it will stop and the while loop will call the next function and the for loop will go backwards by subtracting. Is this true? To be specific here, I thought for loops could only go forwards, because when I remove the second function call "sum(-1, 0, 0)", the for loop will keep going non-stop. I don't get it, I need to understand how this works. And sorry, I'm new to programming.

1 comment
Well 1 thing is you shouldnt put that inside a while loop. What are you trying to make exactly?