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: how do i yield a script

Previous Thread :: Next Thread 
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
01 Nov 2017 06:25 PM
in roblox, for some reason, doing coroutine.yield() on the script's main thread will return the same thing as wait() w/o arguments
is there a way to actually yield it? im trying to push it into a table of threads to be resumed later
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
01 Nov 2017 06:32 PM
forced to use coroutines atm for the main thread
Report Abuse
doggy00 is online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
01 Nov 2017 06:35 PM
this may help:

https://devforum.roblox.com/t/method-for-yielding-a-script/35221
Report Abuse
EdgyCnt is not online. EdgyCnt
Joined: 07 Apr 2008
Total Posts: 44744
01 Nov 2017 06:36 PM
you can't

Roblox's thread scheduler will resume your thread whenever the time passes but it will not remove this thread from its thread queue. This means that calling coroutine.yield sure will yield the thread but when the thread scheduler reaches it it will be resumed instantly since coroutine.yield does not set the "time to resume" field.

Wrap your code in coroutine.create and do not yield from within it, then coroutine.yield will work as expected because the coroutine won't be registered to Roblox's thread sched.
Report Abuse
EdgyCnt is not online. EdgyCnt
Joined: 07 Apr 2008
Total Posts: 44744
01 Nov 2017 06:37 PM
you can't with coroutine.yield alone* (unless you wrap everything)
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
01 Nov 2017 07:03 PM
i did wrap everything and i tried this, my finished script ########################### however, using wait() will make the thread belong to roblox and so will yielding one time i will soon split it away from metas so i can transfer it across scripts on the same machine
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
01 Nov 2017 09:18 PM
ok i found out i can trick it by using wait(1/0) as that makes roblox yield it for eternity
i use coroutine.resume(thread) where thread was stored from coroutine.running()
it works ok but i cant seem to figure out how i would send the parameters
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
01 Nov 2017 09:47 PM
oops i mean 2^127
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
01 Nov 2017 10:53 PM
strange
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