Do functions destroy themselves?

if i run this script

blahblah()
blahbllahblahh()

will they interrupt each other or willl the script automatically make them run aufter each other without me having to put a

task.wait()

inbetween?

5 Likes

They’ll run after each other, as soon as one has finished the next will run.

3 Likes

without interrupting?? no matter how laggy?

3 Likes

Yes, without interrupting, no matter how laggy.

2 Likes

Well it depends what those functions are doing if you count not letting another function run as interrupting then if you have a connection in a function right before another one, it will yield everything after it until the connection has been Disconnected

1 Like

Well as long as one of those functions don’t include a loop running for an indefinite ammount of time, both should be ran after each other and finish correctly and smoothly.

1 Like

If neither of the functions yield they will play at the same time (ish) from what’s percievable to us. But whatever’s in the first function will play in the order specified before the second one kicks in. If the function yields then it really depends on how you used the yield. Using task.spawn / task.delay will run the function in another thread, basically a coroutine, where you’ll be able to run both at the same time.

1 Like
function blahblah()
   print("blahblah")
end

function blahbllahblahh()
  print("blahbllahblahh")
end

blahblah()
blahbllahblahh()
blahbllahblahh()
blahblah()
--[[Output:
blahblah
blahbllahblahh (x2)
blahblah
--]]
function blahblah()
   task.wait(1)
   print("blahblah")
end

blahblah()
blahblah()
--[[Output:
(wait 1 second)
blahblah
(wait 1 second)
blahblah
--]]