Player

The static global Player class contains representations of all players as colors, i.e. “White”. This class has member variables and functions related to the Players’ pointers, hands, blindfolds, etc. For example, to get a reference to Player White, use Player.White or Player[“White”]. If a player is seated at color White, then Player.White.seated will be true.

List of Player Colors

Member Variables

TypeVariable NameDescription
booladminIs the player currently promoted or hosting the game? Read only.
boolblindfoldedIs the player blindfolded? Setting this will blindfold or remove the blindfold on the player.
stringcolorThe player’s player_color. Read only.
boolhost Is the player the host?
floatlift_heightThe player’s lift height from 0 to 1.
boolpromotedIs the player currently promoted?
boolseatedIs the player currently seated at the table? Read only.
stringsteam_idThe player’s Steam ID. Read only.
stringsteam_nameThe player’s Steam name. Read only.
stringteamThe player’s team. (None, Clubs, Diamonds, Hearts, Spades, Jokers)

Functions

Return ValueFunction NameDescription
boolattachCameraToObject(Table parameters) Makes a player’s camera follow an Object.

Parameters Table:


local parameters = {}
parameters.object = Object object_to_attach_to
parameters.offset = Vector –Optional
boolbroadcast(string message)Broadcasts a message to the player. This also sends a message to the top center of the screen.
boolbroadcast(string message, Color)Broadcasts a message to the player with Color. This also sends a message to the top center of the screen.
boolchangeColor(Color)Change the player to this Color.
intgetHandCount()Returns the number of hands that exist for this player color.
TablegetHandObjects(int hand_index = 1)Returns a Lua Table as a list of all the Object in the player’s hand. hand_index lets get objects from a specific hand.
TablegetHandTransform(int hand_index = 1) Returns the Transform of the player’s hand. hand_index lets you edit multiple hands of the same color.

TypeNameDescription
VectorpositionWorld position.
VectorrotationWorld rotation.
VectorscaleLocal scale.
VectorforwardForward direction.
VectorrightRight direction.
VectorupUp direction.

The directional vectors are a coordinate system taking into account the rotation of the player’s hand. This is useful when you want to get a position right in front or next to a player’s hand. See the BlackJack example and how the cards are dealt and how the poker chips are spawned. Returns nil if there is no player assigned to that color.

TablegetHoldingObjects()Returns a Lua Table as a list of all the Object a player is holding.
VectorgetPointerPosition()Returns the position of the given player color’s pointer. Returns nil if the color there is no player assigned to that color.
floatgetPointerRotation()Returns the y-axis rotation of the given player color’s pointer in degrees. This is also essentially the y-axis direction that the player’s camera is facing. Returns nil if there is no player assigned to that color.
TablegetSelectedObjects()Returns a Lua Table as a list of all the Object a player has selected.
boolkick()Kicks a player.
boollookAt(Table parameters) Moves the Player’s camera to look at a specific point. This function forces the Player into the third person mode.

Parameters Table:


local parameters = {}
parameters.position = Vector
parameters.pitch = float pitch –Optional
parameters.yaw = float yaw –Optional
parameters.distance = float distance –Optional
boolmute()Mutes a player so they cannot use voice chat. Call again to unmute.
boolprint(string message)Prints a message to the player.
boolprint(string message, Color)Prints a message to the player with Color.
boolpromote()Promotes a player. Call again to demote.
boolsetHandTransform(Table Transform, int hand_index = 1) Sets the Transform of the player’s hand. hand_index lets you edit multiple hands of the same color.

TypeNameDescription
VectorpositionWorld position.
VectorrotationWorld rotation.
VectorscaleLocal scale.
VectorforwardForward direction.
VectorrightRight direction.
VectorupUp direction.

Class Functions (Player.getSpectators())”

Return ValueFunction NameDescription
TablegetPlayers() Returns a Table as list of all Players.
TablegetSpectators() Returns a Table as list of spectator Players.