Run function if an inventory item has been clicked
Run a function if an inventory item has been clicked
plugin.registerEvent("InventoryClickEvent", function(e)-- Get infolocal player = e:getWhoClicked()local inventoryName = e:getView():getTitle()-- Test if the clicked slot is not emptyif e:getCurrentItem() thenif e:getCurrentItem():getItemMeta() thenif e:getCurrentItem():getItemMeta():getDisplayName() then-- Get item textlocal clickedItemName = e:getCurrentItem():getItemMeta():getDisplayName()-- Test if open inv has contains the nameifstring.find(inventoryName, "This is the inventory title") thenifstring.find(clickedItemName, "WoW crazy item") then-- Here comes your code if the generated item with this name is clickedend-- Disable dragging or dropping item to this inv e:setCancelled(true)endendendendend)