LocalScripts run Lua on each player's client.
They use a smaller API focused on local visuals, the local Player, and talking to the server with MessageModule.
LocalScripts do not share globals with other players or with server Scripts.
The global script refers to the running LocalScript.
Overview
Properties
Methods
- FireServer(name: string, data: any?) deprecated
Events
Prefer Connect on the parent Part when present:
| Event | Where |
|---|---|
| Clicked | `Part.Clicked` |
| Touched | `Part.Touched` |
Older global handlers are listed below as deprecated.
API
Properties
Parent
Parent : Instance?
The local Part this LocalScript is attached to, when parented under a Part.
script.Parent.Clicked:Connect(function(player)
print("clicked")
end)
parent
parent deprecated : Instance?
Identical to Parent.
No longer recommended for use.
Methods
FireServer
FireServer(name: string, data: any?) : void deprecated
Sends a remote event to the server.
Prefer `MessageModule:MessageToServer`.
No longer recommended for use.
FireServer("tool_use")
Events
Touched
Touched(player: Player) deprecated
Older global handler for when the local player enters the LocalScript's parent Part.
Prefer `Part.Touched:Connect`.
No longer recommended for use.
Client globals
LocalScripts have access to:
| Global | Notes |
|---|---|
wait, print | Same idea as Scripts |
player | The local Player |
Players | Client-only: `GetLocalPlayer` (same as player) |
workspace, Workspace | Read-only lookup of existing Models and Parts |
UI | Local Notify and Hud only |
RGBColor, Vector3, Explosion | Value helpers and local VFX |
Instance | `Instance.new("Part")` creates a client-only Part |
InputModule, RaycastModule | Local input and picking |
PlayerMovementModule, CameraModule | Local movement and camera |
TweenModule | Local Part tweens |
Not available on the client: server Players (GetPlayers, PlayerAdded, …), Sound, Chat, NPCs, Shared, and the server-only join or death handlers. Use Players:GetLocalPlayer() or the player global for the local player.
workspace / Workspace can look up existing Models and Parts by name (read-only). Tweens on those Parts are local visuals — other players do not see them. Use a server Script if everyone should see the change.
