Sure, Iâll show you the codes and explain. Hope it helps.
But first, these folders are added to the player when they join a game, just to make things clear.
And the GUI looks like this
(Iâm using screenshots because I realized the forums was doing weird things to my code by splitting stuff âwronglyâ)
First Script(ItemInventoryCheck), ServerScriptService
What this does is look through every child from a folder(ItemInventory), and update values depending on the information inside said child.
If a folderâs(childâs) âitemNameâŚNumberâ value is 0, the folder gets deleted, pretty straight foward.
Second Script(EquipItem), Guiâs LocalScript
The script waits for the player to press the equip button, which creates a new int value. The name is the item and the value is the backpack hotkey(which I canât work on rn cuz of this weird bug) and parents it to the âEquippedBackpackâ. So, the child should already be inside the folder and actually be a child of the folder. Unlike the issue Iâm havingâŚ
Third Script(AssignTools), ServerScriptService
It waits until a child(folder) of ItemInventory(or any other inventory folder) is removed, then calls a function which checks to see if any of the existing int valuesâ names inside âEquippedBackpackâ have a correspoding folder in any of the inventories with the same name. If there is no folder with the same name, it destroys the int value.
Except, it hasnât even got there yet, being stuck at the part where
and this pretty annoying as there are no errors, the int value is just there sitting in the folder, and itâs not finding anything.
Before
Destroying the items
After
Even though the script(s) know the folder is gone, therefore deleting the button, it canât find the int value inside EquippedInventory, which is weird unless thereâs something I donât understand. Not even ChatGPT can solve this one, not with a 3 hour talk of going around in circles.
Another thing I tried was including the in deletion part inside the First Script and just destroy() everything relevant when itemNumber == 0, which was actullaly the original idea, but same thing happened.
I think Iâll go ahead and make some other visual things since I canât really continue the codes with this block in the way.