Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

If i run a function, will it cancel a already running loop?

So i have a function that detects when a player leaves. i also got a loop before hand that counts down. Its no coroutine functions are involved and hopefully wont because i find them a bit less comfortable to work with. My main question is, Will a function at say line 80 cancel out a repeat until false loop thats around line 40.

1 answer

✓ Accepted answer

If you call a function in a loop, the loop will "pause" until the function has returned a value. If you call a function outside a loop (in another thread), then if it affects the loop is mostly up to you.

However, if you are not using coroutines then a function at line 80 cannot be called if an infinite loop is at line 40 (as the function can never be reached as the loop never ends)

https://en.wikipedia.org/wiki/Call_stack

2 comments

0

Heres the thing, it runs.. The function is trigerd and works properly, the and from as far as i can see, the loop still exists. ps this loop is within another function if that matters

0

Plus im worried if i upload its going to cause future problems.

This discussion is preserved as it was. New answers, comments, and votes are closed.