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

Player

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.

int64

CharacterAppearanceId

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

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

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

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.

void

Kick ( string message )

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

void

LoadCharacter ( )

[Yields]

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

void

LoadCharacterBlocking ( )

[Yields]

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

void

LoadCharacterWithHumanoidDescription ( Instance humanoidDescription )

[Yields]
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

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.

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.