Table of Contents
×64 items
Finished Product
Script
local function pickupitem(e) local item_picked = e.itemid Player:gainItems(e.eventobjid, item_picked, 64, 1) end ScriptSupportEvent:registerEvent("Player.PickUpItem", pickupitem)
Explaination
Defining function
local function pickupitem(e)
This line defines a local function named pickupitem, which takes a single argument e. The function is local, meaning it can only be used within the scope where it's defined.
Determining and adding items
local item_picked = e.itemid Player:gainItems(e.eventobjid, item_picked, 64, 1)
item_picked variable is a variable to determine it and get its ID, after that, it'll add items following the ID got from item_picked
ScriptSupportEvent:registerEvent("Player.PickUpItem", pickupitem)
This line registers the pickupitem function to be called whenever the “Player.PickUpItem” event occurs. “Player.PickUpItem” is the name of the event that gets triggered when a player picks up an item. The pickupitem function will be executed whenever this event happens.
If you have any questions about Developer Tools, feel free to join our official Discord Server, Mini World Global DEV Discord