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
 

Re: Easy way to kill a coroutine?

Previous Thread :: Next Thread 
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
14 Jun 2013 04:21 PM
Is there an easy way to simple kill a coroutine preferably outside of it.
Report Abuse
Maradar is not online. Maradar
Joined: 06 Mar 2012
Total Posts: 4478
14 Jun 2013 04:24 PM
Break could work? I don't usually use coroutine.
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
14 Jun 2013 04:25 PM
Outside of the script or ouside of the Coroutine?
Report Abuse
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
14 Jun 2013 04:28 PM
Outside of coroutine.
Report Abuse
gamehero is not online. gamehero
Joined: 12 Jun 2007
Total Posts: 1455
14 Jun 2013 04:46 PM
The easiest way would be to use more than one script simulating a coroutine, then using the Disabled property to kill it. There's really no way to kill a lua coroutine without going inside of it to kill it.

Unless there's a clever solution hardly anyone knows about.
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
14 Jun 2013 04:50 PM
Why wouldnt coroutine.yield work?
Report Abuse
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
14 Jun 2013 04:52 PM
Because that yields the coroutine it is called in.
Report Abuse
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
14 Jun 2013 04:55 PM
How do I completely remove it, not just yield it?
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
14 Jun 2013 04:56 PM
Coroitine:stop(Cornoitine)
Report Abuse
gamehero is not online. gamehero
Joined: 12 Jun 2007
Total Posts: 1455
14 Jun 2013 05:00 PM
You could just do this... If not, what exactly are you making?

=============
Script1:

while true do
wait(0.5)
print("I'm a fake coroutine! Nothing can kill me!")
end

==============
Script2:

wait(4.3)
workspace.Script1:Destroy()
print("Haha!")
Report Abuse
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
14 Jun 2013 05:01 PM
No because I would need to make thousands of scripts if I did that. I'll find a way.
Report Abuse
sycips is not online. sycips
Joined: 21 Mar 2011
Total Posts: 1368
14 Jun 2013 05:28 PM
Sadly you won't... Because there's no way you can stop a coroutine from the outside... That's the same thing as:

function bla()
wait(2)
end

local connection
coroutine.resume(coroutine.create(function() connection = bla() end)

wait(1)

connection:STOP()

^^ This makes no sence, because there's no way you can stop it from the outside!

Maybe we can help you out if you say what you need... Maybe we can help scripting it another way..?

~sycips~
Report Abuse
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
14 Jun 2013 05:28 PM
I've managed to do it, it's just a bit more inefficient than what i would have liked. Ah well.
Report Abuse
sycips is not online. sycips
Joined: 21 Mar 2011
Total Posts: 1368
15 Jun 2013 05:12 AM
Can you post your solution? I'd like to see what you managed to do, because I wouldn't have a clue of how to do this...
Report Abuse
jobro13 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
15 Jun 2013 05:53 AM
error()
Report Abuse
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
15 Jun 2013 05:58 AM
I was trying to kill them when a value updated so i just put.




script.Parent.Aggressive.Value == true then
break
end
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
15 Jun 2013 06:54 AM
break the loop?

coroutine.resume(coroutine.create(function()
while wait() do
if continue then
print("haha nothing can stop me")
else
break
end
end
end))
Report Abuse
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
15 Jun 2013 07:23 AM
Thats what i did yeah.
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