Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. --BasePart Duplicate Remover by Usering
  2.  
  3. local Existing = {}
  4.  
  5. local Duplicates = 0
  6.  
  7. function scan(place)
  8. for _,v in pairs(place:GetChildren()) do
  9. if v:IsA("BasePart") then
  10. local Hash = v.Name:len() * ((v.Position.X * v.Position.Y * v.Position.Z) / (v.Size.X * v.Size.Y * v.Size.Z))
  11. if Existing[Hash] then
  12. print("Found duplicate:",v:GetFullName())
  13. Duplicates = Duplicates + 1
  14. v:Destroy()
  15. else
  16. Existing[Hash] = v
  17. end
  18. end
  19. scan(v)
  20. end
  21. end
  22.  
  23. function recur(paths)
  24. for _,place in pairs(paths) do
  25. scan(place)
  26. end
  27. end
  28. print("--[[Beginning Duplicate Search...]]--")
  29. recur({workspace,game.ServerStorage})
  30. print("Search finished with",Duplicates,"duplicates found and removed.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement