Skip to Content

Client scripts

Client scripts run on each connected device with read-only world access and exclusive access to UI, Input and Effects.

Creating a client script

Set a script's Runs on property to Each player, or right-click in the Explorer and choose New Client Script. Each connected client runs its own instance of the script.

Available services

ServicePurpose
PlayersLocalPlayer and the connected player list.
UIWindows, panels, widgets and on-screen messages.
InputKeyboard and mouse events, mouse ray queries.
EffectsScreen flashes and translucent preview geometry.
ToolsEquipping tools and observing the held tool.
RemoteNamed events to and from the server.
StateRead access to server-replicated values.
WorldRead-only part lookup.
TeamsRead-only team lookup.
BuildPlacement requests in Personal Servers.

World access from client scripts is read only. Changes that affect other players must be requested from the server through Remote.

Parts on the client

World:FindFirstChild(name) returns a read-only part with these fields:

PropertyDescription
NamePart name.
PositionCenter position.
SizeDimensions in studs.
ColorColor3.
SpecialLowercase Type, or nil.
BoundsBounding box size of the part's shape.

Teams on the client

MemberDescription
Name, Color, ScoreRead only.
GetPlayerCount()Number of players on the team.

Example

local Players = game:GetService("Players")
local UI = game:GetService("UI")

local me = Players.LocalPlayer
UI:ShowMessage("Welcome, " .. me.Name .. "!", 3)

On this page