Function stopping when another function is called?

For some reason, which has never happened to me before, my functions are stopping after I call another function?

Sample Example:

local function _functionOne()
	print("FunctionOne")
end

local function _functionTwo()
	print("FunctionTwo - 1")
	_functionOne()  --Code Stops Here?
	print("FunctionTwo - 2")
end

_functionTwo()
1 Like

If your second function has a while do/for do/repeat...until loop that uses a yielding function (like task.wait()) or waits for an event (e.g. `workspace.ChildAdded:Wait()), it will stop for a while.

If, however, you have a loop that should run indefinitely in your second function (loop example: while true do task.wait(0.1) end), that function will never get to finish because it is running its loop still.

Another reason is that your second function threw an error. Check your output and send some code and the related errors if you need more assistance.

1 Like

Guess I learned something new today lol! Thank you for the help! :+1:

1 Like

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