Player
Player : Instance
Overview
Player is an instance that encapsulates information about a player who has accessed the world.
Description
The Player class abstracts and manages various details related to the player, including their interactions within the world. It also allows developers to connect event callbacks to handle specific events, such as when a player connects or disconnects from the world. Additionally, each Player instance provides functionality to classify players into groups based on their team color, enabling team-based interactions and management.
Properties
Character
Model
Represents the player's character associated with the player in workspace.
Code Samples
UserId
string
A unique identifier assigned to the player. This ID can be used for tracking, storing, or identifying the player.
Code Samples
Team
Team
Represents the playerβs team in the world. The value indicates which team the player belongs to.
Code Samples
TeamColor
BrickColor
TeamColor is a property representing the team color associated with a player in the game.
Code Samples
RespawnLocation
SpawnLocation
Represents the spawn location assigned to the player. This is where the player will respawn upon death.
Code Samples
Methods
GetMouse
Returns the Mouse object associated with the player. This can be used to detect mouse actions and get the position of the mouse within the game world.
Parameters
Return
Mouse
Code Samples
LoadCharacter
Load the player avatar character.
Parameters
Return
void
Code Samples
RemoveCharacter
Remove the player avatar character that is currently imported.
Parameters
Return
void
Code Samples
Events
CharacterAdded
CharacterAdded is an event that fires when a player's avatar character is added to the game world. This can be used to handle initialization or setup tasks specific to the character, such as configuring its appearance, abilities, or assigning team-based properties.
Parameters
Code Samples
CharacterRemoving
CharacterRemoving is an event that fires when a player's avatar character is about to be removed from the game world. This can be used to handle cleanup tasks, save game data, or perform actions such as notifying other parts of the system about the character's removal.
Parameters
Code Samples
Last updated