Best way to remove an object with a duplicate name in a model?
Say I have 5 Parts in ModelValues, named:
abc, abc, dba, ddd, ddd
local list = game.ReplicatedStorage.ModelValues:GetChildren() local filter = {} local res = {} for _,v in ipairs(list) do if (not filter[v.Name]) then res[#res+1] = v.Name filter[v.Name] = true else v:Destroy() end end
The output returns:
abc, dba, ddd