Players

The Players service provides functionality for managing player-related actions and information. It allows developers to retrieve player instances, manage player data such as usernames and user IDs, and control aspects like mouse icons. This service is essential for creating interactive experiences that involve player identity and behavior.

Function

Description

GetPlayerFromCharacter(Character: Model): Player

Retrieves the player associated with a given character model. Requires 1 argument: Character (of type Model) representing the character model. Returns the corresponding Player object.

SetMouseIconLocal(Icon: string): nil

Sets the mouse cursor icon locally for the player. Requires 1 argument: Icon (string) representing the icon's asset ID or URL. Returns nil.

GetNameFromUserIdAsync(UserId: number): string

Asynchronously retrieves the username associated with a given user ID. Requires 1 argument: UserId (number) representing the player's user ID. Returns the corresponding username (string).

GetUserIdFromNameAsync(Username: string): number

Asynchronously retrieves the user ID associated with a given username. Requires 1 argument: Username (string) representing the player's username. Returns the corresponding user ID (number).

UnbanPlayer(UserId: number): nil

Unbans a player by their user ID. Requires 1 argument: UserId (number) representing the player's user ID. Returns nil.

IsPlayerBanned(UserId: number): boolean

Checks if a player is banned based on their user ID. Requires 1 argument: UserId (number) representing the player's user ID. Returns a boolean indicating whether the player is banned.

Last updated