usedItem
The inventory:usedItem
event is triggered whenever a player uses an item from their inventory. You can use this event to implement custom logic for specific items.
Event Structure
AddEventHandler('inventory:usedItem', function(itemName, ...)
-- Your logic here
end)
Parameters
itemName
: The name of the used item (string)....
: Additional parameters if the item sends extra data.
Basic Example: Detect Specific Item Use
AddEventHandler('inventory:usedItem', function(itemName)
if itemName == "water_bottle" then
print("Player used a water bottle!")
end
end)
Implementation Steps
Place the code in a server-side.
Match the item name (
itemName
) to your inventory items.Add any custom functionality as needed.
This event is a simple and effective way to extend your inventory system with custom item logic.
Last updated