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

How do I use the function 'return'?

Does calling 'return' in your code make your code run from the very beginning? And could someone explain what 'return false', 'return true', and any others do please?

2 answers

return stops whatever function it's in. When it is inside a function, and you call, for example, return 2, it will stop the function and give back 2.

function giveMeTwoPlease()
   return 2
   game.Workspace.Part:Destroy() --This code will never run.
end

aNumber=giveMeTwoPlease()+1
print(aNumber) --This will print 3.

1 comment

0

Dunno if this is what you meant

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