PlayerState<T>
A value that is kept separately for each player and tells you when it changes, which you create with state.create_per_player.
A value that is kept separately for each player and tells you when it changes, which you create with state.create_per_player.
Gives a copy of one player's value, which still works for 5 seconds after they leave.
print(coins:get(player))Use it forchecking whether a player has enough tokens to buy an item in your shop.
playerThe player.Changes one player's value, and is an error once that player has left.
coins:set(player, 0)Use it forresetting a player's checkpoint when they restart the obby from the beginning.
playerThe player.valueThe new value.Hands your function one player's value, and saves whatever it gives back.
coins:update(player, function(value) return value + 1 end)Use it foradding an item to a player's inventory list without replacing what they already have.
playerThe player.updateGets the value and returns the new one.Adds to one player's number value, or takes away, and gives back the new value.
coins:increment(player, 10)Use it forgiving a player tokens when they pick one up, or taking them away when they buy something.
playerThe player.amountoptionalHow much to add, 1 by default. A negative amount takes away.