I'm having a problem with my dupe gear remover. I have a sword fight arena, and it gives me 2 swords when i step into it and that is a problem for me. (I'm kinda a perfectionist and it also causes problems with double lunging). I have the code here, but it seems to clear both swords and not all but one.
local tmpTable = {} -- store items names for I,v in pairs(player.Backpack:GetChildren()) do -- loop through all items found if tmpTable [v.Name] ~= nil then -- checks if item exists in the list print("a duplicate has been found") -- found item e.g. a duplicate v:Destroy() -- deletes tool else tmpTable [v.Name] = "a" -- we don't need to use the value we are only using the key print("item added to list") end
v:Destroy() -- deletes tool tmpTable[v.Name]=nil else