Hello , I have been trying to make an system or an event that equips or unequips an item.
I have a big problem at
if #EquippedItems[itemtype] ~= 0 then
‘itemtype’ is the type of a item it should look for and ‘equipped items’ is this:
I am trying to find from the ‘Equipped dict’ the itemtype which is either one of those tables inside the ‘Equipped’, so rn itemtype can for ex be “weapons” so I want to look if the weapons table has weapons.
Note, to make this easier for anyone helping I can make it so the armors are not in those specific tables inside the armor dictionary and just identify their armor type another way, so if you can find a solution for only 2 tables / dictionarys that should also work so being specific with the chestplate,helmet,leggings tables is not required for me to make it work
Also, if I clear the table it makes the table completely nil , so also I would like to only clear the contents of the table,
if table.find(Items,Item) then --checks if player has the item unlocked
if #EquippedItems[itemtype] ~= 0 then --here is the PROBLEM OF THE SCRIPT,
EquippedGui:FindFirstChild(itemtype):FindFirstChild(Item).Parent = InventoryGui
table.clear(EquippedItems,itemtype)
end
if itemicon:FindFirstChild("Equipped").Value == false then
itemicon:FindFirstChild("Equipped").Value = true
table.insert(EquippedItems[itemtype],Item)
itemicon.Size = UDim2.new(1,0,1,0)
itemicon.Parent = EquippedGui:FindFirstChild(itemtype)
else
itemicon.Parent = InventoryGui
itemicon:FindFirstChild("Equipped").Value = false
end
Thanks if you actually took your time, usually these "bit longer posts " are not read by people