How does one break out of a touch function?
✓ ANSWER ACCEPTED
What is a function i can use to break out of a function?
1 answer
✓ Accepted answer
to discontinue execution of a function you need to use the return keyword:
for instance:
function sayHello(who)
if(not who) then
print"you did not specify a person to say hello to."
return --terminates further execution!
end
print("Hello, ",who,". how are you?")
end
sayHello("Roblox") --//"Hello, Roblox. How are you"
sayHello()--//"you did not specify a person to say hello to."
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Try 'return'
Make this an answer so i can verify it