We use cookies on this site to enhance your user experience

A LocalScript is a Lua source container that runs Lua code on a client connected to a Roblox server. They are used to access client-only objects, such as the player’s Camera. For code run through LocalScripts, the LocalPlayer property of the Players service will return the player whose client is running the script.

A LocalScript will only run Lua code if it is a descendant of one of the following objects:

  • A Player's Backpack, such as a child of a Tool
  • A Player's Player/Character model
  • A Player's PlayerGui
  • A Player's StarterPlayerScripts
  • The ReplicatedFirst service
  • Note: the parent of the LocalScript will determine which client the Lua code will be executed on.
    See Scripting for information about writing Lua scripts.