Tutorial:LocalScripts, what are they?

Think of a. What it does for your game, and how it works. Now think of a. 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 s run on. Not any player has control of these. Now, every player also has something called a Client. This is where s runs. Each player runs their own version of the local script 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. Local scripts 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 in scripts, s, and command bar.

s are unique, because, unlike other scripts, they can run on both Server and Client, depending on where they are required.

An example of where LocalScripts can be used: they can be used in creating one-sided detail settings, take the game Work at a Pizza Place, in it your able to change the water detail between a part and terrain usually this wouldn't be possible nor would it be reliable, but when you take a LocalScript, you are able to make it client side only.

FilterEnabled
FilterEnabled is a service provided by Roblox, when used it will make it impossible for a client changes to replicate to the server, when disabled LocalScripts are pretty much the same as scripts since there is little to no barrier between server and client.

When LocalScripts should be used
LocalScripts are useful in many situations, in most, it should be used for client-side changes. client-side changes are the best utilization of local scripts due to the fact that local scripts do not directly affect the server. Among other ways to use it you can also use it to connect the client to server, this can be done through remote events and remote functions which can be fired to send a message to the server/client without filter blocking it.