Multiple loops in one script

Sorry for the not detailed/good post,
I just need the answer for a script I’m making.

So, my question is,
How would I go about creating more than a single (while) loop?

I thought maybe using coroutines, but I don’t know how those work.

Any help would really be appreciated!

Huh, cant you put everything in one loop? Why are you trying to use multiple loops?

because im making an stats script. some stats require more seconds to change.

edit: i mean like: seconds in game

Coroutines are the only way from what I know to have multiple while loops going at the same time. I’d suggest looking at videos on how they work or at the Roblox developer help area. I don’t know what it’s called. They are quite useful.

1 Like

Seems like you might need a listener event here instead from what I understand.

i think this may just be the answer, but it may take some time to understand it

Well you could use the coroutine for each stat inside the same loop so it doesnt use a huge amount of memory

1 Like

oh i see how they work now, this topic may have been the most useless thing ever, but atleast i know what to do

Well she/he is trying to wait a couple of seconds and then update the stat’s value, so there’s no listener for that

No, need to apologize. This is the correct place for hard and “useless” topics.

1 Like

Don’t think she was trying to be rude. I think she meant her question was dumb.

1 Like

i didn’t mean to say it in a rude way, im just saying that i could’ve just done some more research on coroutines and that i shouldn’t have madde this topic from the start

You could look at a tutorial for corountines

Here’s a tutorial that you might find helpful:

4 Likes

ill be sure to take a look at it

1 Like

Please mark my post as a solution if it fixes your issue, good luck!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.