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 get both of these threads to run simultaneously

Previous Thread :: Next Thread 
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
04 Jul 2016 02:11 PM
for i =0,-0.9,-0.1 do
gui.TextLabel.Position = gui.TextLabel.Position + UDim2.new(0,0,i,0)
wait(.1)
end
for i = 0,1,.1 do
gui.TextLabel.TextTransparency = i
wait(.1)
end


Add 13,000 posts
Report Abuse
TitanChaser is not online. TitanChaser
Joined: 03 Jul 2016
Total Posts: 71
04 Jul 2016 02:11 PM
coroutines


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
04 Jul 2016 02:12 PM
"coroutines "

im bad at coroutines

wat do


Add 13,000 posts
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
04 Jul 2016 02:12 PM
#code
spawn(function()
for i =0,-0.9,-0.1 do
gui.TextLabel.Position = gui.TextLabel.Position + UDim2.new(0,0,i,0)
wait(.1)
end
end)
for i = 0,1,.1 do
gui.TextLabel.TextTransparency = i
wait(.1)
end


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
04 Jul 2016 02:14 PM
@Jarod

they both work but i like how this code looks more

#code

local moveUp = coroutine.wrap(function()
for i =0,-0.9,-0.1 do
gui.TextLabel.Position = gui.TextLabel.Position + UDim2.new(0,0,i,0)
wait(.1)
end
end)
local fadeOut = coroutine.wrap(function()
for i = 0,1,.1 do
gui.TextLabel.TextTransparency = i
wait(.1)
end
end)
moveUp()
fadeOut()





Add 13,000 posts
Report Abuse
Cinnace is not online. Cinnace
Joined: 21 Jun 2016
Total Posts: 370
04 Jul 2016 02:42 PM
spawn is > coroutine in most situations, all though both have their own applications.


- Cinnace
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
04 Jul 2016 02:42 PM
"spawn is > coroutine in most situations, all though both have their own applications.
"

do you mean performance wise

how big of a difference if so


Add 13,000 posts
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
04 Jul 2016 02:43 PM
@Cinn No, coroutines are better almost all the time. They are more powerful then spawn/delay.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
04 Jul 2016 02:46 PM
But in 9/10 cases, you don't need that kind of precise timing that coroutines supposedly give.


Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
04 Jul 2016 02:49 PM
@jarod Precise or not, coroutines still have WAY more functionality, they have a whole library associated to them. Spawn is just... Left out :(
Report Abuse
Protoduction is not online. Protoduction
Joined: 27 Jul 2012
Total Posts: 1054
04 Jul 2016 03:04 PM
Spawn is better, as it is more efficient. Its just a good habit to use Spawn. You won't really notice a difference (performance wise) between Spawn and Coroutine however.


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
04 Jul 2016 03:05 PM
"Spawn is better, as it is more efficient. Its just a good habit to use Spawn. You won't really notice a difference (performance wise) between Spawn and Coroutine however."

how is it better

coroutines have so much flexibility


Add 13,000 posts
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
04 Jul 2016 03:06 PM
^
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
04 Jul 2016 03:10 PM
Coroutines are also more complicated.
It's like saying my desktop is better just because it's more powerful than my laptop, and has more functionality. It's one-sided and blind.
I can't take my desktop in most vehicles unless they have a power system capable of 500 watts. My laptop can. I can use spawn and delay without having to know all about this coroutine crap, but they aren't as functional.

If you want to make a point, don't do it one-sided.
Trump should be president because of the following:
Pros: His hair looks okay, and I've heard a lot about him.


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
04 Jul 2016 03:11 PM
yeah i did try using spawn before but i was having trouble

but the coroutines felt easier to me

maybe it's just an opinionated sort of thing with what feels better for the person coding


Add 13,000 posts
Report Abuse
Protoduction is not online. Protoduction
Joined: 27 Jul 2012
Total Posts: 1054
04 Jul 2016 03:13 PM
coroutine.create(coroutine.resume(function ( end))
Has a table call and two function calls.

spawn(function() end) is a single function call

wrap is unreliable

And coroutine creates coroutines, which is more than just running code on a separate thread


Report Abuse
doggy00 is not online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
04 Jul 2016 03:15 PM
Couldn't you just make _G variables and run two separate scripts?


what should be siggy be?
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
04 Jul 2016 03:15 PM
"spawn(function() end) is a single function call

wrap is unreliable

And coroutine creates coroutines, which is more than just running code on a separate thread"

this doesnt change my mind


Add 13,000 posts
Report Abuse
Protoduction is not online. Protoduction
Joined: 27 Jul 2012
Total Posts: 1054
04 Jul 2016 03:17 PM
your choice, :P


Report Abuse
Protoduction is not online. Protoduction
Joined: 27 Jul 2012
Total Posts: 1054
04 Jul 2016 03:18 PM
doggy, that is redundant since spawn/coroutine exists.


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
04 Jul 2016 03:18 PM
you are right though, i probably should have defined the coroutines another way

but whatever works well for me


Add 13,000 posts
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
04 Jul 2016 03:19 PM
Put it in two different scripts

:D
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
04 Jul 2016 03:20 PM
"Put it in two different scripts

:D"

that's very inconvenient

better to have it all in one script


Add 13,000 posts
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
04 Jul 2016 03:21 PM
Data Persistance is the correct way to store data, since it's the only way of saving that can save Instances. It's much better, and there's no reason to use anything else.


Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
04 Jul 2016 03:21 PM
orlynow
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