generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: QUICK & EASY

Previous Thread :: Next Thread 
Craftwithcookie is not online. Craftwithcookie
Joined: 21 Dec 2012
Total Posts: 951
01 Aug 2016 09:46 PM
Say I have this:

while true do
wait(1)
print "lel"
end

while true do
wait(1)
print "rekt"
end

Will both loops run or will only the top one work? Sorry im super dumb
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
01 Aug 2016 09:48 PM
Well it will never get past the first loop since you never break out of it.
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
01 Aug 2016 09:48 PM
Only one because it's the same thread and it'll execute top to bottom. Which in this case gets caught up in the first loop.

You can use coroutines like so:

c = coroutine.create(function(...)
while wait(1) do
print "lel"
end
end)

c.resume()

while wait(1) do
print "rekt"
end


Then both will run at about the same time
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image