API:Class/Players

Filtered-inheritance mode: While this class technically inherits all Instance class members, some (if not all) have been hidden because they serve no purpose for this object.
Service: This class is a service. It is a top-level singleton which can be obtained with the GetService method.

Players icon.pngPlayers : Object Icon.pngInstance

This is a service which acts as a container object for all Player objects in a game.

Properties

PropertiesmemberhiddenProperties [toggle]

boolBubbleChat [readonly]

Indicates whether or not bubble chat is enabled. It is set with the SetChatStyle method.

|RMD member="API:Class/Players/BubbleChat"|Indicates whether or not bubble chat is enabled. It is set with the SetChatStyle method.|/RMD|
boolCharacterAutoLoads

Indicates whether Characters will respawn automatically.

|RMD member="API:Class/Players/CharacterAutoLoads"|Indicates whether Characters will respawn automatically.|/RMD|
boolClassicChat [readonly]

Indicates whether or not classic chat is enabled. This property is set by the SetChatStyle method.

|RMD member="API:Class/Players/ClassicChat"|Indicates whether or not classic chat is enabled. This property is set by the SetChatStyle method.|/RMD|
Ref<Player>LocalPlayer [readonly]

The Player that the LocalScript is running for.

|RMD member="API:Class/Players/LocalPlayer"|The Player that the LocalScript is running for.|/RMD|
intMaxPlayers [readonly]

The maximum amount of players that can be in this server.

|RMD member="API:Class/Players/MaxPlayers"|The maximum amount of players that can be in this server.|/RMD|
intPreferredPlayers [readonly]

The preferred amount of players for this server.

|RMD member="API:Class/Players/PreferredPlayers"|The preferred amount of players for this server.|/RMD|
intMaxPlayersInternal [LocalUserSecurity]

MaxPlayers for internal use.

|RMD member="API:Class/Players/MaxPlayersInternal"|MaxPlayers for internal use.|/RMD|
intNumPlayers [deprecated] [readonly]

Deprecated. Do not use.

|RMD member="API:Class/Players/NumPlayers"|Deprecated. Do not use.|/RMD|
intPreferredPlayersInternal [LocalUserSecurity]

PreferredPlayers for internal use.

|RMD member="API:Class/Players/PreferredPlayersInternal"|PreferredPlayers for internal use.|/RMD|
ReflocalPlayer [deprecated] [hidden] [readonly]

Deprecated in favor of LocalPlayer.

|RMD member="API:Class/Players/localPlayer"|Deprecated in favor of LocalPlayer.|/RMD|
intnumPlayers [deprecated] [hidden] [readonly]

Deprecated in favor of NumPlayers.

|RMD member="API:Class/Players/numPlayers"|Deprecated in favor of NumPlayers.|/RMD|
BubbleChat [readonly]
Indicates whether or not bubble chat is enabled. It is set with the SetChatStyle method.
Indicates whether Characters will respawn automatically.
ClassicChat [readonly]
Indicates whether or not classic chat is enabled. This property is set by the SetChatStyle method.
LocalPlayer [readonly]
The Player that the LocalScript is running for.
MaxPlayers [readonly]
The maximum amount of players that can be in this server.
PreferredPlayers [readonly]
The preferred amount of players for this server.
MaxPlayersInternal [LocalUserSecurity]
MaxPlayers for internal use.
NumPlayers [deprecated] [readonly]
Deprecated. Do not use.
PreferredPlayersInternal [LocalUserSecurity]
PreferredPlayers for internal use.
localPlayer [deprecated] [hidden] [readonly]
Deprecated in favor of LocalPlayer.
numPlayers [deprecated] [hidden] [readonly]
Deprecated in favor of NumPlayers.

Functions

FunctionsmemberhiddenFunctions [toggle]

Ref<Player>GetPlayerByUserId ( int userId )

Returns the player with the specified userId, or nil if that player is not in the game.

|RMD member="API:Class/Players/GetPlayerByUserId"| Returns the player with the specified userId, or nil if that player is not in the game.|/RMD|
Ref<Player>GetPlayerFromCharacter ( Model character )

Returns the Player associated with the given character, or nil if the character is not controlled by a player.

|RMD member="API:Class/Players/GetPlayerFromCharacter"|Returns the Player associated with the given character, or nil if the character is not controlled by a player.|/RMD|
array<Player>GetPlayers ( )

Returns a table containing all the players in the server.

|RMD member="API:Class/Players/GetPlayers"|Returns a table containing all the players in the server.|/RMD|
voidChat ( string message ) [PluginSecurity]

Makes the local player chat the given message.

|RMD member="API:Class/Players/Chat"|Makes the local player chat the given message.|/RMD|
PlayerCreateLocalPlayer ( ) [LocalUserSecurity]

Used by the game to create the LocalPlayer.

|RMD member="API:Class/Players/CreateLocalPlayer"|Used by the game to create the LocalPlayer.|/RMD|
voidReportAbuse ( Player player, string reason, string optionalMessage ) [LocalUserSecurity]

Attempts to report the given player for the given reason.

|RMD member="API:Class/Players/ReportAbuse"|Attempts to report the given player for the given reason.|/RMD|
voidSetChatStyle ( ChatStyle style = Classic ) [PluginSecurity]

Sets whether BubbleChat and ClassicChat are being used, and tells TeamChat and Chat what to do.

|RMD member="API:Class/Players/SetChatStyle"|Sets whether BubbleChat and ClassicChat are being used, and tells TeamChat and Chat what to do.|/RMD|
voidTeamChat ( string message ) [PluginSecurity]

Makes the LocalPlayer chat the given message, which will only be viewable by users on the same team.

|RMD member="API:Class/Players/TeamChat"|Makes the LocalPlayer chat the given message, which will only be viewable by users on the same team.|/RMD|
voidWhisperChat ( string message, Player player ) [LocalUserSecurity]

Delivers the given message to a recipient without anyone else seeing.

|RMD member="API:Class/Players/WhisperChat"|Delivers the given message to a recipient without anyone else seeing.|/RMD|
InstancegetPlayerFromCharacter ( Instance character ) [deprecated]

Deprecated in favor of GetPlayerFromCharacter.

|RMD member="API:Class/Players/getPlayerFromCharacter"|Deprecated in favor of GetPlayerFromCharacter.|/RMD|
array<Instance>getPlayers ( ) [deprecated]

Deprecated in favor of GetPlayers.

|RMD member="API:Class/Players/getPlayers"|Deprecated in favor of GetPlayers.|/RMD|
InstanceplayerFromCharacter ( Instance character ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Players/playerFromCharacter"|Deprecated. Do not use.|/RMD|
array<Instance>players ( ) [deprecated]

Deprecated in favor of GetPlayers.

|RMD member="API:Class/Players/players"|Deprecated in favor of GetPlayers.|/RMD|
Returns the player with the specified userId, or nil if that player is not in the game.
Returns the Player associated with the given character, or nil if the character is not controlled by a player.
Returns a table containing all the players in the server.
Chat ( string message ) [PluginSecurity]
Makes the local player chat the given message.
CreateLocalPlayer ( ) [LocalUserSecurity]
Used by the game to create the LocalPlayer.
ReportAbuse ( Player player, string reason, string optionalMessage ) [LocalUserSecurity]
Attempts to report the given player for the given reason.
SetChatStyle ( ChatStyle style = Classic ) [PluginSecurity]
Sets whether BubbleChat and ClassicChat are being used, and tells TeamChat and Chat what to do.
TeamChat ( string message ) [PluginSecurity]
Makes the LocalPlayer chat the given message, which will only be viewable by users on the same team.
WhisperChat ( string message, Player player ) [LocalUserSecurity]
Delivers the given message to a recipient without anyone else seeing.
getPlayerFromCharacter ( Instance character ) [deprecated]
Deprecated in favor of GetPlayerFromCharacter.
getPlayers ( ) [deprecated]
Deprecated in favor of GetPlayers.
playerFromCharacter ( Instance character ) [deprecated]
Deprecated. Do not use.
players ( ) [deprecated]
Deprecated in favor of GetPlayers.

YieldFunctions

YieldFunctions [toggle]

ModelGetCharacterAppearanceAsync ( int userId )

Returns a model containing the assets which the player is wearing, excluding gear.

|RMD member="API:Class/Players/GetCharacterAppearanceAsync"|Returns a model containing the assets which the player is wearing, excluding gear.|/RMD|
dictionaryGetCharacterAppearanceInfoAsync ( int userId )

Returns information about the character appearance of a given user.

|RMD member="API:Class/Players/GetCharacterAppearanceInfoAsync"|Returns information about the character appearance of a given user.|/RMD|
FriendPagesGetFriendsAsync ( int userId )

Returns a FriendPages object which contains information for all of the given player's friends.

|RMD member="API:Class/Players/GetFriendsAsync"|Returns a FriendPages object which contains information for all of the given player's friends.|/RMD|
stringGetNameFromUserIdAsync ( int userId )

Returns the name of a user with the specified userId. This function will error if the user does not exist, so it should be wrapped in a pcall.

|RMD member="API:Class/Players/GetNameFromUserIdAsync"|Returns the name of a user with the specified userId. This function will error if the user does not exist, so it should be wrapped in a pcall.|/RMD|
intGetUserIdFromNameAsync ( string userName )

Returns the userId of a user whose name is specified. This function will error if the user does not exist, so it should be wrapped in a pcall.

|RMD member="API:Class/Players/GetUserIdFromNameAsync"|Returns the userId of a user whose name is specified. This function will error if the user does not exist, so it should be wrapped in a pcall.|/RMD|
Content, boolGetUserThumbnailAsync ( int userId, ThumbnailType thumbnailType, ThumbnailSize thumbnailSize )

Returns the content URL of a user thumbnail based on the specified parameters, and a bool describing if the image is ready to be used or not.

|RMD member="API:Class/Players/GetUserThumbnailAsync"|Returns the content URL of a user thumbnail based on the specified parameters, and a bool describing if the image is ready to be used or not.|/RMD|
Returns a model containing the assets which the player is wearing, excluding gear.
Returns information about the character appearance of a given user.
GetFriendsAsync ( int userId )
Returns a FriendPages object which contains information for all of the given player's friends.
Returns the name of a user with the specified userId. This function will error if the user does not exist, so it should be wrapped in a pcall.
Returns the userId of a user whose name is specified. This function will error if the user does not exist, so it should be wrapped in a pcall.
GetUserThumbnailAsync ( int userId, ThumbnailType thumbnailType, ThumbnailSize thumbnailSize )
Returns the content URL of a user thumbnail based on the specified parameters, and a bool describing if the image is ready to be used or not.

Events

EventsmemberhiddenEvents [toggle]

PlayerAdded ( Player player )

Fires when a player enters the game.

|RMD member="API:Class/Players/PlayerAdded"|Fires when a player enters the game.|/RMD|
PlayerRemoving ( Player player )

Fires when a player is about to leave the game.

|RMD member="API:Class/Players/PlayerRemoving"|Fires when a player is about to leave the game.|/RMD|
PlayerChatted ( PlayerChatType chatType, Player player, string message, Player targetPlayer ) [LocalUserSecurity]

Fired when a player chats. If the chat type is a Whisper Chat, the targetPlayer is the player being whispered to.

|RMD member="API:Class/Players/PlayerChatted"|Fired when a player chats.

If the chat type is a Whisper Chat, the targetPlayer is the player being whispered to.|/RMD|

PlayerConnecting ( Player player ) [LocalUserSecurity]

Fired when a player is connecting to the game.

|RMD member="API:Class/Players/PlayerConnecting"|Fired when a player is connecting to the game.|/RMD|
PlayerDisconnecting ( Player player ) [LocalUserSecurity]

Fired when a player is disconnecting from the game.

|RMD member="API:Class/Players/PlayerDisconnecting"|Fired when a player is disconnecting from the game.|/RMD|
PlayerRejoining ( Player player ) [LocalUserSecurity]

Fired when a player rejoins a game session after having disconnected prior.

|RMD member="API:Class/Players/PlayerRejoining"|Fired when a player rejoins a game session after having disconnected prior.|/RMD|
PlayerAdded ( Player player )
Fires when a player enters the game.
Fires when a player is about to leave the game.
PlayerChatted ( PlayerChatType chatType, Player player, string message, Player targetPlayer ) [LocalUserSecurity]
Fired when a player chats. If the chat type is a Whisper Chat, the targetPlayer is the player being whispered to.
PlayerConnecting ( Player player ) [LocalUserSecurity]
Fired when a player is connecting to the game.
PlayerDisconnecting ( Player player ) [LocalUserSecurity]
Fired when a player is disconnecting from the game.
PlayerRejoining ( Player player ) [LocalUserSecurity]
Fired when a player rejoins a game session after having disconnected prior.

|RMD member="API:Class/Players"|This is a service which acts as a container object for all Player objects in a game. |/RMD|