Skip to main content

hasItem

xPlayer.hasItem(item, metadata)

This functions checks if the player has the specified item, if they do, it will return item and item count :)

Argument

ArgumentData TypeOptionalDefault ValueExplanation
itemstringNo-Item name
metadatastringyes-Item metadata

Example

local item = xPlayer.hasItem("bread")
if item then
print("you have ".. item.count .. " " .. item.label)
else
print('you do not have any bread!")
end