What is the differerence between a local function and a normal function?
I have tried searching the web, saerching youtube, and searching the wiki, but I can't seem to find the difference.
What is the difference between these functions?:
When should I use the local function instead of the non-local function?
local function hey() --Code here end function hey() --Code here end
Any help is greatly appreciated!
A local function can only be used in that area of the script. The global function can be used everywhere. Similar to variables. Here is an example
function Random() s = game end wait(5) s.Workspace.Baseplate:Remove() if Clicked then Random() --[[ I made up random stuff but this is merely an example. You would not be able to access those features if the variables and functions were global. Local usually stay in certain sections of the script. Again, I know this isn't how lua works with the whole end and stuff. Just giving an example.]]--
If you need me to explain more in depth, I will oblige
Marked as Duplicate by User#5423 and BlueTaslem
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?