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

How to stop a function from continuing?

1 answer

Assuming this is just for debugging and you still have code afterwards, you can do

local function foo()
	print("hello")
	do
		return
	end
	print("world")
end
foo()

and that will only print hello.

The reason this works is because return only needs no more code after it in its scope.

Hope this helps!

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