LocalScripts are owned by players. In order to understand how these work, we need to know how ROBLOX works. ROBLOX has one internal machine, called the Server. The Server is what handles the main game, and what Scripts run on. Not any player has control of these. Now, every player also has something called a Client. This is where LocalScripts are ran. Each player runs their own version of the localscript, if it is on their client. Hence the name, LocalScript. This is nice and all, but what is the difference?
Server scripts are meant to control aspects of the game for every player to see. Localscripts do the opposite. LocalScripts control content for the specific player to see. This is where LocalPlayer comes in. LocalPlayer is a reference to the player who owns the LocalScript. Otherwise known as who the LocalScript runs on. LocalPlayer is nil in scripts, CoreScripts, and command bar.
ModuleScripts are unique, because, unlike other scripts, they can run on both Server and Client, depending on where they are require()'d.