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

How do i do 3 while true do loops at once?


Spawn(function() 
	while wait(3) do 
		print("3seconds")   --Prints "3seconds" every 3 seconds and "0.1second" every 0.1 second
end end)

 while wait(0.1) do
	 print("0.1second")
end

Help?

3 comments

1

..Just add another Spawn?

1

i tried that..hmm

1

thx for the effort though

3 answers

✓ Accepted answer

As I said earlier, adding another spawn should fix this. I did forget to mention that you had to use the spawn before your final while loop.

Spawn(function() 
    	while wait(5) do 
        	print("5seconds")   --Prints "5seconds" every 5 seconds and "0.1second" every 0.1 second
	end
end)

Spawn(function() 
    	while wait(3) do 
        	print("3seconds")   --Prints "3seconds" every 3 seconds and "0.1second" every 0.1 second
	end
end)

Spawn(function() -- keep the program looking consistent, and in case you need/want to do something AFTER this part of the script
	 while wait(1) do -- I changed this to 1 btw.
    	 	print("1second")
	end
end)
coroutine.resume(coroutine.create(function()
while wait() do
--first loop
end
end))

coroutine.resume(coroutine.create(function()
while wait() do
--second loop
end
end))

coroutine.resume(coroutine.create(function()
while wait() do
--third loop
end
end))

1 comment

0

Spawning a function is better practice for this type of thing because it's more efficient (because it's merely designed to do just that.)

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