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.
Operation | Description |
---|---|
Player == Player | Checks if two instances of Player refer to the same Player . |
Functions
getCarry
player:getCarry()
Returns the carry container of the player.
Arguments:player
[ Player ]: The player.
- [ Container ]: The player's carry container.
getCarryColor
player:getCarryColor()
Server-Only
Returns the color of the shape the player is carrying.
Arguments:player
[ Player ]: The player.
- [ Color ]: The color of the carried shape.
getCharacter
player:getCharacter()
Returns the player's character.
Arguments:player
[ Player ]: The player.
- [ Character ]: The player's character.
getClientPublicData
player:getClientPublicData()
Client-Only
Returns the player's client public data.
Arguments:player
[ Player ]: The player.
- [ table ]: The player's client public data.
getHotbar
player:getHotbar()
Returns the player's hotbar container.
Arguments:player
[ Player ]: The player.
- [ Container ]: The player's hotbar.
getId
player:getId()
Returns the player's id.
Arguments:player
[ Player ]: The player.
- [ int ]: The player's id.
getInventory
player:getInventory()
Returns the player's inventory container.
Arguments:player
[ Player ]: The player.
- [ Container ]: The player's inventory.
getName
player:getName()
Returns the player's username.
Arguments:player
[ Player ]: The player.
- [ string ]: The player's username.
getPublicData
player:getPublicData()
Server-Only
Returns the player's server public data.
Arguments:player
[ Player ]: The player.
- [ table ]: The player's server public data.
isFemale
player:isFemale()
Returns whether the player is female.
Arguments:player
[ Player ]: The player.
- [ bool ]: Whether the player is female or not.
isMale
player:isMale()
Returns whether the player is male.
Arguments:player
[ Player ]: The player.
- [ 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:player
[ Player ]: The player.
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.