FANDOM


The Players class inherits from Instance.

Properties

Pubfield bool BubbleChat [readonly]

Whether or not bubble chat is enabled.

Pubfield bool CharacterAutoLoads

Set to true, when a player joins a game, they get a character automatically, as well as when they die. When set to false, characters do not auto load and will only load in using Player:LoadCharacter().

Pubfield bool ClassicChat [readonly]

Whether or not classic chat is enabled.

Pubfield Instance LocalPlayer [readonly]

A reference to the local ExplorerImageIndex 12Player. This can only be used in ExplorerImageIndex 18LocalScripts.

Pubfield int MaxPlayers [readonly]

The maximum number of players this place can contain.

Protfield int MaxPlayersInternal [LocalUserSecurity]

Pubfield int NumPlayers [readonly] [deprecated]

The number of players in this place. This has been deprecated, use #game.Players:GetPlayers() instead.

Pubfield int PreferredPlayers [readonly]

The number of preferred players in this place.

Protfield int PreferredPlayersInternal [LocalUserSecurity]

Pubfield Instance localPlayer [deprecated] [hidden] [readonly]

Pubfield int numPlayers [deprecated] [hidden] [readonly]

Methods

Protmethod void Chat(string message) [PluginSecurity]

Protmethod Instance CreateLocalPlayer() [LocalUserSecurity]

Pubmethod Instance GetPlayerByUserId(int64 userId)

Returns a ExplorerImageIndex 12Player that has that id, only if the player is in the game.

Pubmethod Instance GetPlayerFromCharacter(Instance character)

Returns the ExplorerImageIndex 12Player from the given Character, or nil if no player is found.

Pubmethod Objects GetPlayers()

Returns a table of ExplorerImageIndex 12Players in the Players service.

Protmethod void ReportAbuse(Instance player, string reason, string optionalMessage) [LocalUserSecurity]

Protmethod void SetChatStyle(ChatStyle style = Classic) [PluginSecurity]

Protmethod void TeamChat(string message) [PluginSecurity]

Protmethod void WhisperChat(string message, Instance player) [LocalUserSecurity]

Pubmethod Instance getPlayerFromCharacter(Instance character) [deprecated]

Pubmethod Objects getPlayers() [deprecated]

Pubmethod Instance playerFromCharacter(Instance character) [deprecated]

Pubmethod Objects players() [deprecated]

Use GetPlayers() instead

Pubmethod Instance GetCharacterAppearanceAsync(int64 userId) [yield]

Returns a ExplorerImageIndex 2Model containing objects that make up the Player with the given userId's appearance. The player does NOT have to be in game for this to work.

Pubmethod Dictionary GetCharacterAppearanceInfoAsync(int64 userId) [yield]

Pubmethod Instance GetFriendsAsync(int64 userId) [yield]

Pubmethod string GetNameFromUserIdAsync(int64 userId) [yield]

Returns the name of the given Player with the specified userId. The player does NOT have to be in game for this to work.

Pubmethod int64 GetUserIdFromNameAsync(string userName) [yield]

Returns the UserId of the given Player with the specified userName. The player does NOT have to be in game for this to work.

Pubmethod Tuple GetUserThumbnailAsync(int64 userId, ThumbnailType thumbnailType, ThumbnailSize thumbnailSize) [yield]

Attempts to get a player's image without getting a N/A. This method returns two values: The Content of the image, and a bool describing whether or not the image is ready. This method should be looped until it is ready.

Example:

local icon,ready
repeat
    icon,ready = game.Players:GetUserThumbnailAsync(1,Enum.ThumbnailType.AvatarThumbnail,Enum.ThumbnailSize.Size100x100)until ready == true
print(icon)

Events

Protevent FriendRequestEvent(Instance player, Instance player, FriendRequestEvent friendRequestEvent) [RobloxScriptSecurity]

Protevent GameAnnounce(string message) [RobloxScriptSecurity]

Pubevent PlayerAdded(Instance player)

Fires when a ExplorerImageIndex 12Player joins the game.

Protevent PlayerChatted(PlayerChatType chatType, Instance player, string message, Instance targetPlayer) [LocalUserSecurity]

Protevent PlayerConnecting(Instance player) [LocalUserSecurity]

Protevent PlayerDisconnecting(Instance player) [LocalUserSecurity]

Protevent PlayerRejoining(Instance player) [LocalUserSecurity]

Pubevent PlayerRemoving(Instance player)

Fires when a ExplorerImageIndex 12Player leaves the game.

External links

Community content is available under CC-BY-SA unless otherwise noted.