CreatorsServer exports
CountItem
Last updated on
How many units of an item a bag holds.
local res = exports.opx_infinity:CountItem(target, item, metadata)Scope read · sync for a player id; must be awaited when target is a citizen id.
Parameters
-
target:
number | string -
item:
string -
metadata?:
table -
target: a connected player id, or a citizen id (reaches an offline bag; then the call must be awaited). -
item: a catalogue item name, 1–64 characters. -
With a
metadatatable, only stacks with exactly that metadata match. -
Errors other than those listed come from the inventory (for example
no_room,too_heavy,not_enough).
Returns
integer
Errors
export.badArgument, inventory codes
local res = exports.opx_infinity:CountItem(source, 'water')