Inserted material pack 3 times on accident

So you can guess from the title that I inserted the same material pack 3 times and I’m not sure how to remove the duplicate materials. I tried looking it up on the forum but didn’t find anything. I tried clicking random buttons to see if I can remove them and nothing worked. Can anyone tell me how to fix this?

3 Likes

Under MaterialService there should be the materials you’re trying to delete.

3 Likes

Try running this in the command bar, it checks for any children of MaterialService that have the same ColorMap and destroys them.

local ColorMapIdLookup = {}

for _, Child in game:GetService("MaterialService"):GetChildren() do
     if not Child:IsA("MaterialVarient") then
          continue
     end
     if ColorMapIdLookup[Child.ColorMap] then
          Child:Destroy()
          continue
     end
     
     ColorMapIdLookup[Child.ColorMap] = true
end

I wrote this on my phone and havent tested it so it may not work the first time.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.