Hey, I'm making a game and I'm getting this bug that duplicates my items because it doesn't detect if there are 2 of this item from a table. I've tried many ways to figure out how to detect 2 objects in the backpack/character. This is my current script which is basic, but doesn't get the job done if plr.Backpack:FindFirstChild(valks[i][1]) or char:FindFirstChild(valks[i][1]) then else This detects if there is already the same item inside it, but it doesn't prevent from 2 items going in there, how would I make it figure out if 2 of the same objects are in the backpack/character
I would do it by using GetChildren() and then go through each child and compare the child.Name to the object you're checking and if you get a match, don't add the object.