Player
Represents a player in the Players service.
Properties
| Name | Type | Description |
|---|---|---|
Name | string | Player name. Read-only to public ServerScripts and LocalScripts; CoreScripts may change it. |
ClassName | string | Player. |
PlayerID | number | Read-only numeric Glorpia account identifier. Online Studio playtests use the signed-in account ID. Offline Studio playtests use 0. |
Platform | string | Read-only operating-system family reported by the player's client: Windows, macOS, Linux, iOS, Android, or Unknown. |
FramesPerSecond | number | Read-only most recently reported client frame rate. It is 0 until the client has produced its first sample. |
Character | Model or nil | The player's current character Model when one exists. It is the same runtime Instance exposed under Workspace. |
Name is protected from public scripts so creator code cannot rename runtime Player instances. PlayerID, Platform and FramesPerSecond are also read-only runtime data.Methods
| Name | Type | Description |
|---|---|---|
GetMouse() | Mouse | Client-only. Returns the Mouse object for Players.LocalPlayer. The Mouse exposes X, Y, Button1Down, Button1Up, Button2Down, Button2Up, Move, WheelForward and WheelBackward. |
GetNetworkPing() | number | Returns the player's most recently measured round-trip network latency in seconds. It is 0 until a ping sample is available. |
GetMouse() is available from LocalScripts and CoreScripts and only for Players.LocalPlayer. GetNetworkPing() is readable for Player instances on both client and server.Events
| Name | Type | Description |
|---|---|---|
CharacterAdded | signal (Model) | Fires when the Player receives a new Character Model. |
CharacterRemoving | signal (Model) | Fires when the Player's current Character is removed or replaced. |
Camera
| Name | Type | Description |
|---|---|---|
CameraMaxZoomDistance | number | Maximum gameplay camera zoom distance. Defaults to 128. |
CameraMinZoomDistance | number | Minimum gameplay camera zoom distance. Defaults to 0.5. |
NameDisplayDistance | number | Maximum camera distance in studs at which this player's character username tag is rendered. Defaults to 100; 0 hides the tag. |
CameraMinZoomDistance and CameraMaxZoomDistance are read by the default CameraScript and can be changed at runtime. NameDisplayDistance is evaluated against the active camera when the username tag is rendered.Children
Player is a normal hierarchy parent. Scripts and Studio can parent other Instances beneath a Player, and those children replicate with the Player hierarchy. Physical Parts beneath a Player are stored and replicated but are not rendered or simulated until reparented somewhere below Workspace.
Studio playtests
When Studio starts an online playtest, the Player instance uses the signed-in Studio account's username and PlayerID. In Studio offline mode, the playtest identity defaults to Player with PlayerID 0.
The Player and its Character hierarchy remain visible in both Client and Server view. In Server view, Player data is for inspection while the server remains authoritative over the runtime character and replicated world state.
Player runtime example
local Players = game:GetService("Players")
local player = Players.LocalPlayer
if player then
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
print("Mouse:", mouse.X, mouse.Y)
end)
player.CharacterAdded:Connect(function(character)
print("Character added:", character:GetFullName())
end)
player.CharacterRemoving:Connect(function(character)
print("Character removing")
end)
print("Ping seconds:", player:GetNetworkPing())
end