Hi there,
I’ve encountered an issue with functions.
So here I have this code:
local function Function1()
print("Pizza")
wait(1)
print("Burger")
end
local function Function2()
print("Fries")
wait(1)
print("Tacos")
end
Function1()
Function2()
Function3()
Function4()
print("Functions are done running.")
The issue is that I need to wait until all the functions finish running to print ("Functions are done running.")
Is there a way I can print it and run the functions at the same time ?
you can use the task library for this. task.spawn(f) puts function f on its own thread and runs it. If you spawn the functions you can achieve this. You could also use coroutines but in this case it is not necessary.