Open Asterune
LocalScript

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

Members4
Properties2
Methods2

Properties

Disabled

LocalScript.Disabled: boolean = false

Whether 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(): table

Returns the script instances available through this script binding.

Inherited members

Inherited47

Example

Luau
local Players = game:GetService("Players")
local player = Players.LocalPlayer
print(player.UserId)

Script · ModuleScript · Players · RunService