GSmGpE6CwX2y9JjB25B8
We use cookies on this site to enhance your user experience
Collapse Sidebar

Player

Show Show deprecated

Player

Show deprecated

A Player object a client that is currently connected. These objects are added to the Players service when a new player connects, then removed when they eventually disconnect from the server.

The Instance/Name property reflects the player’s username. When saving information about a player, you should use their Player/UserId since it is possible that a player can change their username.

There are several similar methods in the Players for working with Player objects. Use these over their respective Instance methods:

  • You can get a table of current Player objects using Players/GetPlayers; again, use this instead of Instance/GetChildren.
  • To detect the addition of Player objects, it is recommended to use the Players/PlayerAdded event (instead of Instance/ChildAdded on the Players service).
  • Similarly, you can detect the removal of Player objects using Players/PlayerRemoving, which fires just before the Player is removed (instead of Instance/ChildRemoved which fires after). This is important if you are saving information about the player that might be removed or cleaned up on-removal.

Properties

int

AccountAge

[ReadOnly] [NotReplicated]

Describes the player’s account age in days.

bool

AutoJumpEnabled

Determines whether the character of a player using a mobile device will automatically jump upon hitting an obstacle.

float

CameraMaxZoomDistance

The maximum distance the player’s camera is allowed to zoom out.

float

CameraMinZoomDistance

The minimum distance the player’s camera is allowed to zoom in.

CameraMode

CameraMode

Changes the camera’s mode to either first or third person.

bool

CanLoadCharacterAppearance

Determines whether the character’s appearance will be loaded when the player spawns. If false, the player will spawn with a default appearance.

Model

Character

A Model controlled by the player that contains a Humanoid, body parts, scripts and other objects.

string

CharacterAppearance

[NotBrowsable] [Deprecated]

The URL of the asset containing the character’s appearance, clothing, and gear

int64

CharacterAppearanceId

Determines the user ID of the account whose character appearance is used for a player’s Player/Character|character

int

DataComplexity

[ReadOnly] [NotReplicated] [Deprecated]

The total amount of data currently being stored in the Player|Player's cache on the current place

int

DataComplexityLimit

[NotReplicated] [Deprecated]

The maximum amount of data that can be stored to a Player|Player's cache per place

bool

DataReady

[ReadOnly] [NotReplicated] [Deprecated]

Indicates when the player’s data is available to load

DevCameraOcclusionMode

DevCameraOcclusionMode

Sets how the default camera handles objects between the camera and the player.

DevComputerCameraMovementMode

DevComputerCameraMode

Determines player’s camera movement mode when using a desktop version of Roblox.

DevComputerMovementMode

DevComputerMovementMode

Determines player’s character movement mode when using a desktop version of Roblox.

bool

DevEnableMouseLock

Determines if the player can toggle mouse lock

DevTouchCameraMovementMode

DevTouchCameraMode

Determines player’s camera movement mode when using a touch device.

DevTouchMovementMode

DevTouchMovementMode

Determines player’s character movement mode when using a touch device.

int64

FollowUserId

[ReadOnly] [NotReplicated]

Describes the user ID of the player who was followed into a game by a player.

bool

GameplayPaused

float

HealthDisplayDistance

Sets the distance at which this player will see other Humanoid’s health bars. If set to 0, the health bars will not be displayed.

string

LocaleId

[Hidden] [ReadOnly] [NotReplicated]

This property shows the locale id that the local player has set for their Roblox account.

float

MaximumSimulationRadius

[NotReplicated]

The maximum value a Player’s Player/SimulationRadius can grow to.

MembershipType

MembershipType

[ReadOnly] [NotReplicated]

Describes the account’s membership type (NBC, BC, TBC or OBC).

float

NameDisplayDistance

Sets the distance at which this player will see other Humanoid’s names. If set to 0, names are hidden.

bool

Neutral

Determines whether the player is on a specific team.

Instance

ReplicationFocus

Sets the part to focus replication around.

SpawnLocation

RespawnLocation

If set, the player will respawn at the given SpawnLocation

float

SimulationRadius

The simulation radius of a Player’s Player/Character.

Team

Team

[NotReplicated]

Determines the Team with which a Player is associated.

BrickColor

TeamColor

Determines the Team with which a Player is associated.

int64

UserId

A unique identifying integer assigned to all user accounts

int64

userId

[Deprecated]

Inherited from Instance: Show Hide

bool

Archivable

Determines if an Instance can be cloned using /Instance/Clone or saved to file.

string

ClassName

[ReadOnly] [NotReplicated]

A read-only string representing the class this Instance belongs to

int

DataCost

[ReadOnly] [NotReplicated] [Deprecated]

The cost of saving the instance using data persistence.

string

Name

A non-unique identifier of the Instance

Instance

Parent

Determines the hierarchical parent of the Instance

bool

RobloxLocked

If true, the Instance and its descendants cannot be indexed or edited by a Script or LocalScript and will throw an error if it is attempted

bool

archivable

[Hidden] [NotReplicated] [Deprecated]
string

className

[ReadOnly] [NotReplicated] [Deprecated]

Functions

void

ClearCharacterAppearance ( )

Removes all accessories and other character appearance objects from a player’s Character.

float

DistanceFromCharacter ( Vector3 point )

Returns the distance between the character’s head and the given Vector3 point. Returns 0 if the player has no character.

Array

GetFriendsOnline ( int maxFriends )

[Yields]

Return a dictionary of online friends, specified by maxFriends.

Dictionary

GetJoinData ( )

Returns a dictionary containing information on how the Player joined the game

Instance

GetMouse ( )

Returns the mouse being used by the client.

int

GetRankInGroup ( int64 groupId )

[Yields]

Returns the player’s rank in the group as an integer between 0 and 255, where 0 is a non-member and 255 is the group’s owner.

string

GetRoleInGroup ( int64 groupId )

[Yields]

Returns the player’s role in the group as a string, or “Guest” if the player isn’t part of the group.

bool

HasAppearanceLoaded ( )

Returns whether or not the appearance of the player’s character has loaded.

bool

IsBestFriendsWith ( int64 userId )

[Yields] [Deprecated]

Returns whether a player is friends with the specified user

bool

IsFriendsWith ( int64 userId )

[Yields]

Checks whether a player is a friend of the user with the given Player/UserId

bool

IsInGroup ( int64 groupId )

[Yields]

Checks whether a player is a member of a group with the given ID.

bool

IsUserAvailableForExperiment ( )

[Deprecated]

Returns true if the user is available for Roblox experiments

void

Kick ( string message )

Forcibly disconnect a player from the game, optionally providing a message.

bool

LoadBoolean ( string key )

[Deprecated]

Returns a boolean value that was previously saved to the player with Player/SaveBoolean with the same key

void

LoadCharacter ( )

[Yields]

Creates a new character for the player, removing the old one. Also clears the player’s Backpack and PlayerGui.

void

LoadCharacterAppearance ( Instance assetInstance )

[Deprecated]

Places the given instance either in the player’s character, head, or StarterGear based on the instance’s class.

void

LoadCharacterBlocking ( )

[Yields]

Functions similar to Player/LoadCharacter, but the request is processed synchronously instead of asynchronously.

void

LoadCharacterWithHumanoidDescription ( Instance humanoidDescription )

[Yields]
void

LoadData ( )

[Deprecated]

Used by an ancient data persistence method to load the user’s Data Persistence

Instance

LoadInstance ( string key )

[Deprecated]

Returns an instance that was previously saved to the player with Player/SaveInstance with the same key

double

LoadNumber ( string key )

[Deprecated]

Returns a number value that was previously saved to the player

string

LoadString ( string key )

[Deprecated]

Returns a string value that was previously saved to the player

void

Move ( Vector3 walkDirection , bool relativeToCamera )

Causes the player’s character to walk in the given direction until stopped, or interrupted by the player (by using their controls).

void

RemoveCharacter ( )

Removes the player’s character.

void

SaveBoolean ( string key , bool value )

[Deprecated]

Used to save a boolean value that can be loaded again at a later time using Player/LoadBoolean

void

SaveData ( )

[Deprecated]

Used by an ancient data persistence method to save the user’s data

void

SaveInstance ( string key , Instance value )

[Deprecated]

Saves an instance which can be loaded again at a later time

void

SaveNumber ( string key , double value )

[Deprecated]

Saves a number value that can be loaded again at a later time using

void

SaveString ( string key , string value )

[Deprecated]

Saves a string value that can be loaded again at a later time

void

SetAccountAge ( int accountAge )

Sets the AccountAge of the player.

void

SetSuperSafeChat ( bool value )

Sets whether or not the player sees filtered chats, rather than normal chats.

bool

WaitForDataReady ( )

[Yields] [Deprecated]

Used to pause the script until the player’s data is available to manipulate, or until a certain amount of time has elapsed without fetching the player’s data

bool

isFriendsWith ( int64 userId )

[Yields] [Deprecated]
bool

loadBoolean ( string key )

[Deprecated]
Instance

loadInstance ( string key )

[Deprecated]
double

loadNumber ( string key )

[Deprecated]
string

loadString ( string key )

[Deprecated]
void

saveBoolean ( string key , bool value )

[Deprecated]
void

saveInstance ( string key , Instance value )

[Deprecated]
void

saveNumber ( string key , double value )

[Deprecated]
void

saveString ( string key , string value )

[Deprecated]
bool

waitForDataReady ( )

[Yields] [Deprecated]

Inherited from Instance: Show Hide

void

ClearAllChildren ( )

This function destroys all of an Instance's children.

Instance

Clone ( )

Create a deep copy of a Roblox instance and descendants where Archivable = true.

void

Destroy ( )

Sets the Instance/Parent property to nil, locks the Instance/Parent property, disconnects all connections and calls Destroy on all children.

Instance

FindFirstAncestor ( string name )

Returns the first ancestor of the Instance whose Instance/Name is equal to the given name.

Instance

FindFirstAncestorOfClass ( string className )

Returns the first ancestor of the Instance whose Instance/ClassName is equal to the given className.

Instance

FindFirstAncestorWhichIsA ( string className )

Returns the first ancestor of the Instance for whom Instance/IsA returns true for the given className.

Instance

FindFirstChild ( string name , bool recursive )

Returns the first child of the Instance found with the given name.

Instance

FindFirstChildOfClass ( string className )

Returns the first child of the Instance whose Instance/ClassName|ClassName is equal to the given className.

Instance

FindFirstChildWhichIsA ( string className , bool recursive )

Returns the first child of the Instance for whom Instance/IsA returns true for the given className.

Objects

GetChildren ( )

Returns an array containing all of the Instance's children.

string

GetDebugId ( int scopeLength )

[NotBrowsable]

Returns a coded string of the Instances DebugId used internally by Roblox.

Array

GetDescendants ( )

[CustomLuaState]

Returns an array containing all of the descendants of the instance

string

GetFullName ( )

Returns a string describing the Instance's ancestry.

RBXScriptSignal

GetPropertyChangedSignal ( string property )

Get an event that fires when a given property of an object changes.

bool

IsA ( string className )

[CustomLuaState]

Returns true if an Instance's class matches or inherits from a given class

bool

IsAncestorOf ( Instance descendant )

Returns true if an Instance is an ancestor of the given descendant.

bool

IsDescendantOf ( Instance ancestor )

Returns true if an Instance is a descendant of the given ancestor.

void

Remove ( )

[Deprecated]

Sets the object’s Parent to nil, and does the same for all its descendants.

Instance

WaitForChild ( string childName , double timeOut )

[CustomLuaState] [CanYield]

Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does.

Objects

children ( )

[Deprecated]

Returns an array of the object’s children.

Instance

clone ( )

[Deprecated]
void

destroy ( )

[Deprecated]
Instance

findFirstChild ( string name , bool recursive )

[Deprecated]
Objects

getChildren ( )

[Deprecated]
bool

isA ( string className )

[Deprecated] [CustomLuaState]
bool

isDescendantOf ( Instance ancestor )

[Deprecated]
void

remove ( )

[Deprecated]

Events

RBXScriptSignal

CharacterAdded ( Instance character )

Fired when a player’s character spawns or respawns.

RBXScriptSignal

CharacterAppearanceLoaded ( Instance character )

Fires when the the full appearance of a Player's Player/Character has been inserted

RBXScriptSignal

CharacterRemoving ( Instance character )

Fired right before a player’s character is removed.

RBXScriptSignal

Chatted ( string message , Instance recipient )

Fires when a player chats in-game using Roblox’s provided chat bar.

RBXScriptSignal

Idled ( double time )

Usually fired two minutes after the game engine classes the player as idle. Time is the amount of seconds since this point.

RBXScriptSignal

OnTeleport ( TeleportState teleportState , int64 placeId , string spawnName )

Fired when the TeleportState of a player changes.

RBXScriptSignal

SimulationRadiusChanged ( float radius )

Fired when the Player's Player/SimulationRadius is changed.

Inherited from Instance: Show Hide

RBXScriptSignal

AncestryChanged ( Instance child , Instance parent )

Fires when the Instance/Parent property of the object or one of its ancestors is changed.

RBXScriptSignal

Changed ( string property )

Fired immediately after a property of an object changes.

RBXScriptSignal

ChildAdded ( Instance child )

Fires when an object is parented to this Instance.

RBXScriptSignal

ChildRemoved ( Instance child )

Fires when a child is removed from this Instance.

RBXScriptSignal

DescendantAdded ( Instance descendant )

Fires when a descendant is added to the Instance

RBXScriptSignal

DescendantRemoving ( Instance descendant )

Fires immediately before a descendant of the Instance is removed.

RBXScriptSignal

childAdded ( Instance child )

[Deprecated]