LocalScript
Executes Luau on a client.
- Creatable
Instance.new("LocalScript")- Inherits
- BaseScriptLuaSourceContainerInstance
- Replication
- Standard
Behavior
LocalScript runs on one client. Use it for player input, interfaces, and camera
control. Players.LocalPlayer identifies that client’s player.
Supported execution containers include StarterPlayerScripts under
StarterPlayer, StarterGui, and the player's backpack.
A LocalScript in workspace does not execute.
Client changes remain local. Send requests through a RemoteEvent for the server to validate and apply.
Summary
Whether execution is disabled.
The Luau text of the script.
Returns this instance if it is an ExecutionGroup.
Returns the script instances available through this script binding.
Properties
Disabled
LocalScript.Disabled: boolean = falseWhether execution is disabled. Setting this to false starts the script from the beginning.
Source
LocalScript.Source: string = ""The Luau text of the script.
Methods
GetExecutionGroup
LocalScript:GetExecutionGroup(): ExecutionGroup?Returns this instance if it is an ExecutionGroup. Otherwise returns the nearest ancestor ExecutionGroup, or nil when no group contains the instance.
GetScripts
LocalScript:GetScripts(): tableReturns the script instances available through this script binding.
Inherited members
- Properties
- ArchivableClassNameNameParent
- Methods
- AddComponent()AddTag()ClearAllChildren()ClearTags()Clone()Destroy()FindFirstAncestor()FindFirstAncestorOfClass()FindFirstAncestorWhichIsA()FindFirstChild()FindFirstChildOfClass()FindFirstChildWhichIsA()FindFirstDescendant()GetAttribute()GetAttributeChangedSignal()GetAttributes()GetChildren()GetComponent()GetComponentChangedSignal()GetComponents()GetDebugId()GetDescendants()GetFullName()GetPropertyChangedSignal()GetReferencing()GetTags()HasComponent()HasTag()IsA()IsAncestorOf()IsDescendantOf()RemoveComponent()RemoveTag()SetAttribute()WaitForChild()
- Events
- AncestryChangedAttributeChangedChangedChildAddedChildRemovedDescendantAddedDescendantRemovingDestroying
Example
local Players = game:GetService("Players")
local player = Players.LocalPlayer
print(player.UserId)Related APIs
Script · ModuleScript · Players · RunService