I am working on a variation of the base mining game and trying to add an additional tool, addding to the existing pickaxe.
I believe I have created the tool correctly and it does appear on the screen and if I click it equips as a grey plank (temporary) and if I click the plank the Tool Activate occurs. My problem is if I click on the tool to unequip it the tools dissappears. It has been removed from the active players backpack but not returned to the local players backpack.
There is code for the tool but it only contains prints.
There is no code anywhere that does Destroy of the tool.
I think I can code so when an object is disovered a clone of the tool from RS can be added to the backpack and code the tools to be single use by using Parent:Destroy in the unequip but am trying to have the tool always in the backpack like the pickaxe and add a count in the backpack for the number of SafeBox tools so when it is activated and the count is > 0 it does its bit and then decrements the count .
The count is what is sort of visible in the pictures.
The tool only has the part called Handle and an Int counter.
I have coded a work round which checks for existance of SafeBox in the Active player and if not found checks SafeBox in Backpack and if not found restores from RS. If SafeBox was found (in my case is does) it checks for the count if that does not exist it does a restore from RS. In my case the count is not found so the code restores the SafeBox from RS.
It looks to me like the process for re-assigning the Parent from the Active Player back into the Backpack has a problem.
I believe the Backpack code is in the core so may not be able to investigate further.
I have found the cause of my problem.
If I move the counter to be child of Handle all works well without my work around.
The root cause appears to be that although the reassign works for backpack to active player it fails on the return because it does not handle Value objects placed directly under the tool and causes an incomplete reassignment.