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

How can i return to a line?

How can i return to a line in a script?

1 answer

There isn't a way to "return" to a line, not in Lua 5.1 (the base version of lua ROBLOX uses).

BUT, you can use something, such as a function or a loop to repeat something, essentially going over the lines in the function's or loop's scope an amount of times.

function SomeFunc()
	print("I have been executed!")
end

SomeFunc() --> I have been executed!
SomeFunc() --> I have been executed!
SomeFunc() --> I have been executed!
for i = 1, 3 do
	print("For loop output")
end -- Would print "For loop output" to the console 3 times

local x = 0
while x < 10 do
	print("While loop output")
	x = x + 1
end -- Would print "While loop output" 10 times

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