A LocalScript runs code on the playerโs device, not on the server.
It controls things like:
| Script (Server) | LocalScript (Client) |
|---|---|
| Runs on the server | Runs on the playerโs PC |
| Can access everything | Can only access certain things |
| Handles game logic, saving, enemies | Handles UI, input, player camera, effects |
LocalScripts only work in specific places:
| Location | โ Works? |
|---|---|
StarterPlayerScripts |
โ Yes |
StarterCharacterScripts |
โ Yes |
StarterGui |
โ Yes |
Tool or StarterPack |
โ Yes |
ReplicatedFirst |
โ Yes (for loading screen, etc.) |
Workspace |
โ No |
ServerScriptService |
โ No |
Server Scripts only run in specific locations on the server side:
| Location | โ Works? | ๐ก Notes |
|---|---|---|
ServerScriptService |
โ Yes | Best for most server logic, secure and clean |
Workspace |
โ Yes | Useful for scripts tied to parts or models |
StarterCharacterScripts |
โ Yes | Runs once per character spawn |
Tool or inside a Tool in Workspace |
โ Yes | For tool server-side functionality |
ReplicatedStorage |
โ No | Can store scripts, but they wonโt run |
StarterGui |
โ No | GUI is client-side; use LocalScripts instead |
StarterPlayerScripts |
โ No | Meant for LocalScripts only |