Functions
Functions are like variables in a way. Functions are used to declare multiple lines of code, while a variable is to declare usually one line of code. To make a function work, you need to declare it by its name. Functions are very useful in a scripters career, and can get stuff done a lot faster. A example of a function is provided below.
local function MyFunction()
print("Hello!")
end
MyFunction() -- Runs the function
The code above will print "Hello!" because we declare it at the bottom. A functions format is "local function (Function Name)()" Functions always need to be closed with a "end" If a function is not ran, it will not return a error and instead will stay unused.
Last updated