Hello I need help reworking my equip / unequip item system, currently how its supposed to work is an event is launched with additional arguments that provide the gui that was clicked aswell as the item wanting to be removed / added to the equip.
I know I atleast need this information to make this work =
-How to remove contents of a table
-How to check if a table is empty
some additional help is always appriciated
Note the equippeditemstable is basically a table with all of the equipped items including weapons aswell as armor since they are in different tables I had to use loops to get them all to the table.
also the itemtype is also done the same way so it sees what type of a item is being equipped/unequipped to be put in the correct slot.
if table.find(Items,Item) then --if the player actually owns the item he is equip/unequipping if #equippeditemstable ~= 0 then -- trying to see if there is anything equipped EquippedGui:FindFirstChild(itemtype):FindFirstChild(Item).Parent = InventoryGui --trying to set the already equipped item's gui back to the inventory from the equipped slot table.remove(EquippedItems[itemtype]) -- I want to know how to remove the contents of this table end if itemicon:FindFirstChild("Equipped").Value == false then -- if the item gui is equipped itemicon:FindFirstChild("Equipped").Value = true -- sets the item's gui to be equipped table.insert(EquippedItems[itemtype],Item) -- adds the equipped item to the table / datastore itemicon.Size = UDim2.new(1,0,1,0) itemicon.Parent = EquippedGui:FindFirstChild(itemtype) --finds the item's itemtype's gui else itemicon.Parent = InventoryGui --else if it is equipped for ex. the gui was pressed when in the while on the equipped slot itemicon:FindFirstChild("Equipped").Value = false table.remove(EquippedItems[itemtype],Item) end end