*Very basic RbxLua knowledge
Roblox uses a pretty well known model called the client-server model. The clients are the computers thats connected to the server, one of these connected computers is your own computer. All of these clients are
communicating through the server. The server is a powerful computer thats probably located in some sort of
Im sure that you,ve come across the term Filtering Enabled which has suprisingly nothing to do with the roblox
chat filter. If filtering enabled is turned on, you basically prevent the server from blindly replicating what
the clients do on their end. You can get around this rule by setting a so called network ownership, but i wont
be covering that in this tutorial.
As you probably know there are 3 different types of scripts that are avaible to us, LocalScripts, Scripts and ModuleScripts. Localscripts will run on every clients computer, while scripts will run on the server. But
what about module scripts? are they clientsided or serversided?
When it comes to moduleScripts it all dependson what they are being required by. If you require the module
from a local script the module will run on the client, but if you require that module from a
script it will run on the server.
I bet that you,ve seen the storage folders called: ServerScriptService, ReplicatedStorage, ServerStorage,
StarterPack and so on. All of these game services has their own purposes, and there are reasons for why you should
place your scripts(not LocalScripts) in the ServerScriptService.
ServerScriptService acts like a container for server scripts(Script). The contents of this container will only
be avaible to be accessed by other scripts running on the server, that is becuse the content doesnt replicate to the clients.
The server and clients do not naturally share memory after all.
We say that ServerScriptService is ServerSided
ServerStorage works just like ServerScriptService, but any scripts put inside the container wont run(thats what
we have ServerScriptService for right?). Instead the purpose of ServerStorage is simply to store data for the server.
We say that ServerStorage is ServerSided.
ReplicatedStorage is pretty much what it sounds like. Its purpose is to keep data, but this data can be
accessed by both client and the server. This is possible becuse the data in the storage is replicated(just
like the name tells us, its a replicated storage).
StarterPack is another game service, this is one of the places where you could place your LocalScripts, the
contents of StarterPack will be cloned and put into the players backpack which is a child of player.
The LocalScripts doesnt run in the Starterpack, they will run in the backpack. If you think about it, it does
make sense that you would put your LocalScripts here, since every client will get a clone of this
LocalScript and have it run on his or her computer. We say that StarterPack is ClientSided.
The main source was me, so i may be wrong on some of these explanations. To test yourself i suggest that
you ask yourself why you cant get the LocalPlayer in a Script(ServerScript).