Skip to main content

Player

Associated namespace: sm.player

A userdata object representing a player in the game.

Values:

  • character [ character ]

    • Get: The player's character.
  • clientPublicData [ table ]

    • Get: (Client-Only) The player's client public data.
    • Get: (Client-Only) Sets the player's client public data.
  • id [ int ]

    • Get: The player's id.
  • name [ string ]

    • Get: The player's username.
  • publicData [ int ]

    • Get: (Server-Only) The player's server public data.
    • Get: (Server-Only) Sets the player's server public data.

Operations:

OperationDescription
Player == PlayerChecks if two instances of Player refer to the same Player.

functions

getCarry

player:getCarry()

Returns the carry container of the player.

Parameters:

Returns:


getCarryColor

player:getCarryColor()

Server-Only

Returns the color of the shape the player is carrying.

Parameters:

Returns:

  • (Color): The color of the carried shape.

getCharacter

player:getCharacter()

Returns the player's character.

Parameters:

Returns:


getClientPublicData

player:getClientPublicData()

Client-Only

Returns the player's client public data.

Parameters:

Returns:

  • (table): The player's client public data.

getHotbar

player:getHotbar()

Returns the player's hotbar container.

Parameters:

Returns:


getId

player:getId()

Returns the player's id.

Parameters:

Returns:

  • (int): The player's id.

getInventory

player:getInventory()

Returns the player's inventory container.

Parameters:

Returns:


getName

player:getName()

Returns the player's username.

Parameters:

Returns:

  • (string): The player's username.

getPublicData

player:getPublicData()

Server-Only

Returns the player's server public data.

Parameters:

Returns:

  • (table): The player's server public data.

isFemale

player:isFemale()

Returns whether the player is female.

Parameters:

Returns:

  • (boolean): Whether the player is female or not.

isMale

player:isMale()

Returns whether the player is male.

Parameters:

Returns:

  • (boolean): Whether the player is male or not.

placeLift

player:placeLift( creation, position, level, rotation )

Server-Only

Places the player's lift.

Parameters:

  • player (Player): The player.
  • creation (table): The bodies to place on the lift.
  • position (Vec3): The lift's world position.
  • level (int): The lift's level.
  • rotation (int): The rotation of the lifted creation.

removeLift

player:removeLift()

Server-Only

Removes the player's lift, if it exists.

Parameters:


sendCharacterEvent

player:sendCharacterEvent( event )

Server-Only

Sends an event to the player's character script.

The event is received by the client_onEvent callback in the character script.

Parameters:

  • player (Player): The player.
  • event (string): The event.

setCharacter

player:setCharacter( character )

Server-Only

Sets the player's character.

Parameters:


setClientPublicData

player:setClientPublicData( data )

Client-Only

Sets the player's client public data.

Parameters:

  • player (Player): The player.
  • data (table): The data to set.

setPublicData

player:setPublicData( data )

Server-Only

Sets the player's server public data.

Parameters:

  • player (Player): The player.
  • data (table): The data to set.