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.

Arguments:
Returns:

getCarryColor

player:getCarryColor()
Server-Only

Returns the color of the shape the player is carrying.

Arguments:
Returns:
  • [ Color ]: The color of the carried shape.

getCharacter

player:getCharacter()

Returns the player's character.

Arguments:
Returns:

getClientPublicData

player:getClientPublicData()
Client-Only

Returns the player's client public data.

Arguments:
Returns:
  • [ table ]: The player's client public data.

getHotbar

player:getHotbar()

Returns the player's hotbar container.

Arguments:
Returns:

getId

player:getId()

Returns the player's id.

Arguments:
Returns:
  • [ int ]: The player's id.

getInventory

player:getInventory()

Returns the player's inventory container.

Arguments:
Returns:

getName

player:getName()

Returns the player's username.

Arguments:
Returns:
  • [ string ]: The player's username.

getPublicData

player:getPublicData()
Server-Only

Returns the player's server public data.

Arguments:
Returns:
  • [ table ]: The player's server public data.

isFemale

player:isFemale()

Returns whether the player is female.

Arguments:
Returns:
  • [ bool ]: Whether the player is female or not.

isMale

player:isMale()

Returns whether the player is male.

Arguments:
Returns:
  • [ bool ]: Whether the player is male or not.

placeLift

player:placeLift( creation, position, level, rotation )
Server-Only

Places the player's lift.

Arguments:
  • 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.

Arguments:

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.

Arguments:
  • player [ Player ]: The player.
  • event [ string ]: The event.

setCharacter

player:setCharacter( character )
Server-Only

Sets the player's character.

Arguments:

setClientPublicData

player:setClientPublicData( data )
Client-Only

Sets the player's client public data.

Arguments:
  • player [ Player ]: The player.
  • data [ table ]: The data to set.

setPublicData

player:setPublicData( data )
Server-Only

Sets the player's server public data.

Arguments:
  • player [ Player ]: The player.
  • data [ table ]: The data to set.