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: Small issue

Previous Thread :: Next Thread 
ColdDeveloper is online. ColdDeveloper
Joined: 25 Jan 2010
Total Posts: 3344
19 Jan 2017 02:31 AM
Hey, so I have a coroutine inside a module script, which is used to play a game-mode so that the main script can track the progress of who is alive, etc. Problem is because its a coroutine it won't just end. So how can I make it just stop the coroutine? Thanks :)


Report Abuse
nooneisback is not online. nooneisback
Joined: 28 Feb 2012
Total Posts: 1672
19 Jan 2017 05:27 AM
module = {}
module.Coro
module.Run = function()module.Coro=coroutine.wrap(function()
--stuff
end)end)
module.End = function()coroutine.yield(module.Coro)end)
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
19 Jan 2017 06:55 AM
"module = {}
module.Coro
module.Run = function()module.Coro=coroutine.wrap(function()
--stuff
end)end)
module.End = function()coroutine.yield(module.Coro)end)"


Noooo. That won't work.




Report Abuse
nooneisback is not online. nooneisback
Joined: 28 Feb 2012
Total Posts: 1672
19 Jan 2017 09:35 AM
Then why not give a solution? I rarelly use modules myself and would like to know the answer to this question too.
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
19 Jan 2017 10:11 AM
I would if I knew the problem. All I know is that there is a coroutine in a module, that isn't enough to go off of.




Report Abuse
nooneisback is not online. nooneisback
Joined: 28 Feb 2012
Total Posts: 1672
19 Jan 2017 10:13 AM
He basically wants to yield a coroutine on command which is in the module.
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
19 Jan 2017 10:31 AM
Still not sure what the problem is, but maybe this will help:

local module = {}

function module:run()
self.running = true
coroutine.resume(coroutine.create(function()
while self.running do
-- stuff
end
end))
end

function module:stop()
self.running = false
end

return module



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