Here's part of what i have (the whole script is kinda huge and messy but this is the only part i'm having trouble with lol)
integer amount;
list main_menu = ["copy","transfer","cancel"];
integer channel;
integer listen_handle;
init() {
llListenRemove(listen_handle);
channel = llFloor(llFrand(2000000)); //random channel so multiple scripts don't interfere with each other
listen_handle = llListen(channel, "", "", ""
;}
default
{ state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
{ init(); }
channel = llFloor(llFrand(2000000)); //random channel so multiple scripts don't interfere with each other
listen_handle = llListen(channel, "", "", ""
;}
money(key id, integer payed)
{
if (payed != amount)
{
llGiveMoney(id, payed);
return;
}
llDialog(id, "\n\nSelect your desired permissions", main_menu, channel);
}
listen(integer channel, string name, key id, string message) {
if (llListFindList(main_menu, [message]) != -1) {
if (message == "copy"

llGiveInventory(id,llGetInventoryName(INVENTORY_OBJECT, (0)));
return;
}else if
(message == "transfer"

{llGiveInventory(id,llGetInventoryName(INVENTORY_OBJECT, (1)));
return;
}
else if
(message == "cancel"

llGiveMoney(id, payed);
return;
}
}