Skip to main content

Player Component

Component Available
ServerYes
ClientYes

This is the component that handles storing & retrieving all player-related data.

Required Attributes


Server

  • GetData: function

Client

  • SetData: function
  • GetData: function

Methods


Server

GetData

  • Parameters: discord: string
  • Return: value: table
  • Description: Retrieves the user data from the database by their Discord ID, if no user with their ID exists it will create one.

Client

GetData

  • Parameters: key: string
  • Return: value: any
  • Description: Retrieves data that was bound to the player object with the given key.

SetData

  • Parameters: key: string, value: any
  • Return: None
  • Description: Sets data bound to the player object with the given key.

Events


Server

No server events are fired from this component.

Client

Player:Client:SetData

  • Sent Values: playerData: table
  • Description: Updates the targetted clients local player object data.

Entity


When a player joins the server fully an event Queue:Server:SessionActive is fired which the processing of loading that players data. That data is stored in an object that is stored in a table in base which has its own methods to store & retrieving data specific to that player. To get this data you must go through the Fetch Component.

Methods

GetData

  • Parameters: key: string
  • Return: value: any
  • Description: Retrieves data that was bound to the player object with the given key.

SetData

  • Parameters: key: string, value: any
  • Return: None
  • Description: Sets data bound to the player object with the given key.

Permissions (Prefix: Permissions)

IsAdmin

  • Parameters: None
  • Return: boolean
  • Description: Checks whether or not if the player is in a Discord role that was defined as a staff role.

GetLevel

  • Parameters: None
  • Return: int
  • Description: Returns the max permission level the user has based on Discord roles.