FANDOM


This tutorial is intermediate. All Tutorials · Scripting tutorials.
This tutorial is not done. Feel free to add to it.

Think of a ExplorerImageIndex 6Script. What it does for your game, and how it works. Now think of a ExplorerImageIndex 18LocalScript. Have you ever used one of those? What is the difference between the two? Is everything the same? No.

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 ExplorerImageIndex 6Scripts run on. Not any player has control of these. Now, every player also has something called a Client. This is where ExplorerImageIndex 18LocalScripts 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, ExplorerImageIndex 0CoreScripts, and command bar.

ExplorerImageIndex 76ModuleScripts are unique, because, unlike other scripts, they can run on both Server and Client, depending on where they are require()'d.