Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with duplicate item remover?

Asked by 3 years ago

Im trying to make one but what is wrong with my code becuase whenever i get the sword from the sword giver it gives me 1 but when i take the sword out it gives me 2.

local tmpTable = {} -- store items names
02   
03   for I,v in pairs(player.Backpack:GetChildren()) do --  loop through all items found
04   
05      if  tmpTable [v.Name] ~= nil then -- checks if item exists in the list
06   
07          print("a duplicate has been found") -- found item e.g. a duplicate
08   
09   v:Destroy() -- deletes tool
10   
11      else
12   
13          tmpTable [v.Name]  = "a"  -- we don't need to use the value we are only using the key
14   
15          print("item added to list")
16   
17   
18  end

0
Are you doing this via the Client...? I also recommend initializing the key with 'true'. Ziffixture 6913 — 3y
0
Yeah via the client epic_hen9 27 — 3y
0
Also im a begginer scripter i need help with this because whenever i get the sword it gives me one but if i take it out it gives me 2. epic_hen9 27 — 3y

Answer this question