Player
Represents a connected player and their session state.
- Not creatable
- Created by the engine or used as a base class.
- Inherits
- Instance
- Replication
- PlayerReplicate
Behavior
Player represents a connected player. The engine creates it on join and removes
it on departure. Character references the current character model and is
replaced on respawn. Store session state on the player rather than the character
when it must persist across respawns.
Summary
The account age in days.
The container for unequipped tools.
The maximum camera distance from the character, in studs.
The minimum camera distance from the character, in studs.
Whether the default camera permits third-person viewing or locks to first person.
Whether appearance assets are loaded for the player's character.
The current character model, or nil between spawns.
The user identifier used to load the character's appearance.
Whether character loading is automatic for this player.
How the default camera handles geometry obscuring the character.
The default camera movement mode for keyboard and mouse input.
The default character movement mode for keyboard and mouse input.
Whether the player can use the mouse-lock camera mode.
The default camera movement mode for touch input.
The default character movement mode for touch input.
The display name used for the player or character.
The user identifier associated with the player's follow join.
Whether gameplay is paused for the player.
The maximum distance for the character's health display, in studs.
The locale identifier used for this session or player.
The account's membership category.
The maximum distance for the character's name display, in studs.
Whether the player is unassigned to a Team.
The container for this player’s GUI.
The SpawnLocation selected for this player's next respawn.
The player's assigned Team, or nil when no Team is assigned.
The color identifying the player's team assignment.
The permanent numeric account ID.
Removes appearance instances from the player's character.
Returns the distance from the character to the supplied world-space point, in studs.
Returns this instance if it is an ExecutionGroup.
Returns the join and transfer data associated with this player.
Returns the local player's PlayerMouse interface.
Returns the measured network round-trip time for the player.
Returns the player's numeric rank in the specified group.
Returns the player's role name in the specified group.
Returns whether the current character appearance has finished loading.
Returns whether the player is friends with the specified user.
Whether the player represents a guest session.
Returns whether the player belongs to the specified group.
Whether the account has verified status.
Disconnects the player with an optional message.
Loads or respawns the player's character.
Requests movement in a direction.
Removes the player's current character.
Fires when the player receives a character Model.
Fires when the player's character appearance finishes loading.
Fires before the player's character is removed.
Fires when the player sends a chat message.
Fires when the player has remained inactive.
Fires when the player's place-transfer state changes.
Properties
AccountAge
Player.AccountAge: number = 0The account age in days.
Backpack
Player.Backpack: Backpack?The container for unequipped tools. Equipping a tool moves it into the character model.
CameraMaxZoomDistance
Player.CameraMaxZoomDistance: number = 400The maximum camera distance from the character, in studs.
CameraMinZoomDistance
Player.CameraMinZoomDistance: number = 0.5The minimum camera distance from the character, in studs.
CameraMode
Player.CameraMode: Enum.CameraMode = Enum.CameraMode.ClassicWhether the default camera permits third-person viewing or locks to first person.
CanLoadCharacterAppearance
Player.CanLoadCharacterAppearance: booleanWhether appearance assets are loaded for the player's character.
Character
Player.Character: Model? = nilThe current character model, or nil between spawns. The model contains character parts and a Humanoid. Reacquire this reference after respawn and check for nil before use.
CharacterAppearanceId
Player.CharacterAppearanceId: numberThe user identifier used to load the character's appearance.
CharacterAutoLoads
Player.CharacterAutoLoads: booleanWhether character loading is automatic for this player.
DevCameraOcclusionMode
Player.DevCameraOcclusionMode: EnumItemHow the default camera handles geometry obscuring the character.
DevComputerCameraMode
Player.DevComputerCameraMode: EnumItemThe default camera movement mode for keyboard and mouse input.
DevComputerMovementMode
Player.DevComputerMovementMode: EnumItemThe default character movement mode for keyboard and mouse input.
DevEnableMouseLock
Player.DevEnableMouseLock: booleanWhether the player can use the mouse-lock camera mode.
DevTouchCameraMode
Player.DevTouchCameraMode: EnumItemThe default camera movement mode for touch input.
DevTouchMovementMode
Player.DevTouchMovementMode: EnumItemThe default character movement mode for touch input.
DisplayName
Player.DisplayName: string = ""The display name used for the player or character.
FollowUserId
Player.FollowUserId: number = 0The user identifier associated with the player's follow join.
GameplayPaused
Player.GameplayPaused: booleanWhether gameplay is paused for the player.
HealthDisplayDistance
Player.HealthDisplayDistance: numberThe maximum distance for the character's health display, in studs.
LocaleId
Player.LocaleId: stringThe locale identifier used for this session or player.
MembershipType
Player.MembershipType: EnumItemThe account's membership category.
NameDisplayDistance
Player.NameDisplayDistance: numberThe maximum distance for the character's name display, in studs.
Neutral
Player.Neutral: boolean = trueWhether the player is unassigned to a Team.
PlayerGui
Player.PlayerGui: PlayerGui?The container for this player’s GUI. A ScreenGui parented here is displayed only to this player.
RespawnLocation
Player.RespawnLocation: SpawnLocation?The SpawnLocation selected for this player's next respawn.
Team
Player.Team: Team? = nilThe player's assigned Team, or nil when no Team is assigned.
TeamColor
Player.TeamColor: BrickColor = BrickColor.new(194)The color identifying the player's team assignment.
UserId
Player.UserId: number = 0The permanent numeric account ID. Use it as a key for player data; names can change.
Methods
ClearCharacterAppearance
Player:ClearCharacterAppearance(): ()Removes appearance instances from the player's character.
DistanceFromCharacter
Player:DistanceFromCharacter(point: Vector3): numberReturns the distance from the character to the supplied world-space point, in studs.
GetExecutionGroup
Player:GetExecutionGroup(): ExecutionGroup?Returns this instance if it is an ExecutionGroup. Otherwise returns the nearest ancestor ExecutionGroup, or nil when no group contains the instance.
GetJoinData
Player:GetJoinData(): tableReturns the join and transfer data associated with this player.
GetMouse
Player:GetMouse(): PlayerMouseReturns the local player's PlayerMouse interface.
GetNetworkPing
Player:GetNetworkPing(): numberReturns the measured network round-trip time for the player.
GetRankInGroup
Player:GetRankInGroup(group_id: number): numberReturns the player's numeric rank in the specified group.
GetRoleInGroup
Player:GetRoleInGroup(group_id: number): stringReturns the player's role name in the specified group.
HasAppearanceLoaded
Player:HasAppearanceLoaded(): booleanReturns whether the current character appearance has finished loading.
IsFriendsWith
Player:IsFriendsWith(user_id: number): booleanReturns whether the player is friends with the specified user.
IsGuest
Player:IsGuest(): booleanWhether the player represents a guest session.
IsInGroup
Player:IsInGroup(group_id: number): booleanReturns whether the player belongs to the specified group.
IsVerified
Player:IsVerified(): booleanWhether the account has verified status.
Kick
Player:Kick(message: string?): ()Disconnects the player with an optional message.
LoadCharacter
Player:LoadCharacter(at: CFrame?): booleanLoads or respawns the player's character.
Move
Player:Move(walkDirection: Vector3, relativeToCamera: boolean?): ()Requests movement in a direction. Pass true as the second argument to use camera-relative coordinates instead of world coordinates.
RemoveCharacter
Player:RemoveCharacter(): ()Removes the player's current character.
Events
CharacterAdded
Player.CharacterAdded: RBXScriptSignalFires when the player receives a character Model.
CharacterAppearanceLoaded
Player.CharacterAppearanceLoaded: RBXScriptSignalFires when the player's character appearance finishes loading.
CharacterRemoving
Player.CharacterRemoving: RBXScriptSignalFires before the player's character is removed.
Chatted
Player.Chatted: RBXScriptSignalFires when the player sends a chat message. Passes the message string.
Idled
Player.Idled: RBXScriptSignalFires when the player has remained inactive.
OnTeleport
Player.OnTeleport: RBXScriptSignalFires when the player's place-transfer state changes.
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
if player.Character then
print(player.Character.Name)
end