Skip to content

SetPlayerState

Sets a key of a player’s bag, read by every client.

Every client has every player’s bag from its join on - GetPlayerState(pid, key); the client’s own pid is GetPlayerId(). Gone with the player’s session.

SetPlayerState(pid, key, value)
Parameter Type
pid number the player
key string 1-48 characters
value string | number | boolean | nil kept as a string; nil removes the key

boolean - false when not connected or out of bounds

SetPlayerTeam(pid, 2)
SetPlayerState(pid, "team", 2) -- the client scripts color the label by it

GetPlayerState · GetPlayerStates · SetGlobalState · SetPlayerData · the State bags group of the index