Player

Associated namespace: sm.player

A userdata object representing a player in the game.

Values:

Functions:

Operations:

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

character Character

Get:

Returns the character the player is controlling.


clientPublicData table

Get:

Client only

Returns client public data from a player.

Set:

Client only

Sets client public data on a player.


id integer

Get:

Returns the id of a player.


name string

Get:

Returns the name of a player.


publicData table

Get:

Server only

Returns (server) public data from a player.

Set:

Server only

Sets (server) public data on a player.


getCarry(player)

Returns the carry container of the player.

Parameters:

TypeNameDescription
PlayerplayerThe player.

Returns:

TypeDescription
ContainerThe player's carry.

getCarryColor()

Server only

Returns the color of the shape the player is carrying.

Returns:

TypeDescription
ColorThe color of the shape the player is carrying.

getCharacter(player)

Returns the character the player is controlling.

Parameters:

TypeNameDescription
PlayerplayerThe player.

Returns:

TypeDescription
CharacterThe player's character.

getClientPublicData(player)

Client only

Returns client public data from a player.

Parameters:

TypeNameDescription
PlayerplayerThe player.

Returns:

TypeDescription
tableThe client public data.

getHotbar(player)

Returns the hotbar container of the player.

Parameters:

TypeNameDescription
PlayerplayerThe player.

Returns:

TypeDescription
ContainerThe player's hotbar.

getId(player)

Returns the id of a player.

Parameters:

TypeNameDescription
PlayerplayerThe player.

Returns:

TypeDescription
integerThe player's id.

getInventory(player)

Returns the inventory container of the player.

Parameters:

TypeNameDescription
PlayerplayerThe player.

Returns:

TypeDescription
ContainerThe player's inventory.

getName(player)

Returns the name of a player.

Parameters:

TypeNameDescription
PlayerplayerThe player.

Returns:

TypeDescription
stringThe player's name.

getPublicData(player)

Server only

Returns (server) public data from a player.

Parameters:

TypeNameDescription
PlayerplayerThe player.

Returns:

TypeDescription
tableThe public data.

isFemale(player)

Check if the player is female

Parameters:

TypeNameDescription
PlayerplayerThe player

Returns:

TypeDescription
booleanTrue if female

isMale(player)

Check if the player is male

Parameters:

TypeNameDescription
PlayerplayerThe player

Returns:

TypeDescription
booleanTrue if male

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

Server only

Place down a lift game object

Parameters:

TypeNameDescription
PlayerplayerThe player to own the lift.
tablecreationThe bodies to place on the lift. {Body, ..}
Vec3positionThe lift position.
integerlevelThe lift level.
integerrotationThe rotation of the creation on the lift.

removeLift(player)

Server only

Remove the player's lift, if the lift exists.

Parameters:

TypeNameDescription
PlayerplayerThe player that owns the lift.

sendCharacterEvent(player, event)

Server only

Sends an event to a given player

Parameters:

TypeNameDescription
PlayerplayerThe player to send to
stringeventThe event to send

setCharacter(player, character)

Server only

Sets the character the player is controlling.

Parameters:

TypeNameDescription
PlayerplayerThe player.
CharactercharacterThe character.

setClientPublicData(player, data)

Client only

Sets client public data on a player.

Parameters:

TypeNameDescription
PlayerplayerThe player.
tabledataThe client public data.

setPublicData(player, data)

Server only

Sets (server) public data on a player.

Parameters:

TypeNameDescription
PlayerplayerThe player.
tabledataThe public data.