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 » Scripting Helpers
Home Search
 

Begin Loop But Continue Script

Previous Thread :: Next Thread 
xXLiLxJXx is not online. xXLiLxJXx
Joined: 15 Mar 2012
Total Posts: 687
19 Jun 2014 10:20 PM
Is there a way to do this?
Report Abuse
robertjh12 is not online. robertjh12
Joined: 24 Feb 2008
Total Posts: 601
19 Jun 2014 10:21 PM
Make the loop a coroutine
Report Abuse
TheNewScripter is not online. TheNewScripter
Joined: 02 Mar 2010
Total Posts: 2432
19 Jun 2014 10:23 PM
    function loop()
        while true do
            print("Hello, world.")
            wait(5)
        end
    end
    
    local thread = coroutine.create(loop)
    coroutine.resume(thread)
    print("Hello, thread.")

Coroutines are multi-threaded, meaning they run independently from your script. Basically, it's like having a script inside of your script. However, be warned: if the coroutine errors, it doesn't print the error to the output window.
Report Abuse
xXLiLxJXx is not online. xXLiLxJXx
Joined: 15 Mar 2012
Total Posts: 687
19 Jun 2014 10:27 PM
Holy.. Thank you for explaining that to me! That will be epically useful 0-0
Report Abuse
TheNewScripter is not online. TheNewScripter
Joined: 02 Mar 2010
Total Posts: 2432
19 Jun 2014 10:28 PM
No problem.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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