๐Ÿ“œ INTRO TO LocalScripts โ€“ Roblox Scripting


๐Ÿ’ก What is a LocalScript?

A LocalScript runs code on the playerโ€™s device, not on the server.

It controls things like:


๐Ÿ›‘ Difference: Script vs LocalScript

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

๐Ÿงฉ Where can I put LocalScripts?

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

โš™๏ธ Where can I put Server Scripts?

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