How can I run a loop while another loop is already running at the same time?
Asked by
3 years ago Edited 3 years ago
Hey there. How can I run a loop (like > for) while another loop in the same script running at the same time?
Like, a part will move in X direction and the same part will also rotate 90 degrees in Z direction at the same time. The problem is, I don't wanna run them in the same loop because I wanna repeat the move command 20 times and rotate thing only 6 times. I'm kinda new to scripting, though.
Let me explain, here's the moving script:
2 | script.Parent.Position = script.Parent.Position + Vector 3. new( 1 , 0 , 0 ) |
and here's the rotation (Orientation) one:
2 | script.Parent.Orientation = script.Parent.Orientation + Vector 3. new( 0 , 0 , 15 ) |
as I said, I want them to repeat different times(move loop 20 times and rotation one 6 times) so I can't put them in the same loop. Putting them in an order will cause the script do it one by one; it'll move first, and when it's complete it'll start to rotate but I don't want that. I want the script to do those things at the same time. I hope you understand! (idk if it's possible in Lua, but I would be very happy if you help me!).