I'm new to coding and so while trying to learn what certain commands I have seen a few scripts in which there will be a line like
local player
or
local humanoid
I wasn't sure if they had a purpose so I tested those scripts removing these lines and the script would immediately crash. What is the purpose of these, and what does it mean when they have no "=" to define them as something else?
Those are variables that will be referred to later. Here is a section of my scripts that I apply it in:
local mainDataTable -- here I name the variable local success, message = pcall(function() mainDataTable = mainDataStore:GetAsync(specialKey) -- here I assign it a value. If I had done local mainDataTable inside this function then the rest of the script would not be able to use it. So I set the variable first then gave it a value end)
Hope this helps and have a great day scripting!