Hello,
I have this while true do
loop below which loops a print forever. How can I make it so it only loops this process for 10 seconds?
while true do
wait(0)
print("One cycle completed")
wait(1)
end
Hello,
I have this while true do
loop below which loops a print forever. How can I make it so it only loops this process for 10 seconds?
while true do
wait(0)
print("One cycle completed")
wait(1)
end
You could use a for loop for this, like so:
for i = 1, 10 do -- starts from x (1), until y (10)
task.wait(1)
print('Cycle completed, on', i)
-- every time loop runs, 'i' is the number of the current cycle
end
Awesome, thanks so much! I’ll test this… and if it works, I will mark it as my solutuion.
for i = 10, 0, -1 do
print(i)
task.wait(1)
end
If you’re looking for a timer.
what do these numbers mean?
edit:
the i= x represents how many times it loops
the middle represents what number the loop ends at
and the final number represents intervals the i=x is changed by each loop.