This is the script i currently have in the box it works perfectly fine i you leave it with just llGetOwner() but then not everyone can take the objects.
integer dialog_channel= 450; // set a dialog channel
list menu = [ "Inspect", "Take Candy" ];
default
{
state_entry()
{
llListen( dialog_channel, "", NULL_KEY, ""

;
}
touch_start(integer total_number)
{
llDialog( llDetectedKey( 0 ), "Select from the below Options?", menu, dialog_channel );
}
listen(integer channel, string name, key id, string choice )
{
if ( llListFindList( menu, [ choice ]) != -1 )
{
if ( choice == "Inspect" )
{
llSay(0, "As you take a closer look at the wooden box, you can see a text on the top reading Sura's Candy Box."

;
}
}
if( choice == "Take Candy" )
{
list inventory;
string name;
integer num = llGetInventoryNumber(INVENTORY_OBJECT);
string text = " Searching Box...\n";
integer i;
key user = llDetectedKey(0);
for (i = 0; i < num; ++i) {
name = llGetInventoryName(INVENTORY_OBJECT, i);
if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY)
inventory += name;
else
llOwnerSay("Cannot give asset \""+name+"\", owner lacks copy permission"

;
llSetText(text + (string)((integer)(((i + 1.0) / num) * 100))+ "%", <1, 1, 1>, 1.0);
}
text = llGetObjectName();
i = llListFindList(inventory, [llGetScriptName()]);
if(~i)//if this script isn't found then we shouldn't try and remove it
inventory = llDeleteSubList(inventory, i, i);
if (llGetListLength(inventory) < 1) llSay(0, "The Box is Empty no Candy left."

; else
{
llGiveInventoryList(user, text, inventory);
llSetText("The Box is slightly open seems\nlike someone stoled some of your Candy!",<1,1,1>,1);
name = "Your new "+ text +" can be found in your inventory, in a folder called '"+ text +"'. ";
if(user == llGetOwner())
llOwnerSay(name);
else
llInstantMessage(user, name);
}
}
}
}