How to get accessory details?

i’m heading to destroy all accessorys made after 2016/9/29.

for the reason, i have to get accessory details.

if it’s impossible, is it possible to get creator of accessory? i want to destroy all UGC.

1 Like

Would it not be better to just prevent users from having their own avatar loaded? Alternatively you could load their humanoid description and cherry-pick it.

It’d be better to just check the accessory creator’s username in order to determine if the accessory is an official Roblox creation or UGC.

local players = game:GetService("Players")
local marketplace = game:GetService("MarketplaceService")

players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if not player:HasAppearanceLoaded() then
			player.CharacterAppearanceLoaded:Wait()
		end
		
		local humanoid = character:WaitForChild("Humanoid")
		local description = humanoid:WaitForChild("HumanoidDescription")
		local accessories = description:GetAccessories(true)
		for _, accessory in ipairs(accessories) do
			local assetId = accessory.AssetId
			local success, result = pcall(function()
				return marketplace:GetProductInfo(assetId)
			end)
			
			if success then
				if result then
					if result.Creator.Name ~= "Roblox" then
						local characterAccessory = character:FindFirstChild(result.Name)
						if characterAccessory then
							characterAccessory:Destroy()
						end
					end
				end
			else
				warn(result)
			end
		end
	end)
end)
2 Likes

If you know the id of the last catalog item created on the date you gave, use that as a check threshold. When the character’s appearance loads, check all accessory fields of their HumanoidDescription and see if any of the ids exceed this threshold (you will need to use split as accessory fields are CSVs). Reapply the modified HumanoidDescription such that no accessory CSV contains an id higher than the threshold.

2 Likes

nice idea! but sadly i will give solution check to forummer for teaching how to get details of accessory. sorry and thanks!

edit : oooh, Forummer’s result table have created date!

well this is not a perfect Solution.

for explain, my angry bird mask’s result name is “Angry Birds: Red’s Mask” but the accessory name in the character if “AngryBirds_RedHead”. so your script can’t find my mask and can’t destroy it.
but thanks. I’ll fix it myself

local players = game:GetService("Players")
local marketplace = game:GetService("MarketplaceService")
local insert = game:GetService("InsertService")

players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if not player:HasAppearanceLoaded() then
			player.CharacterAppearanceLoaded:Wait()
		end

		local humanoid = character:WaitForChild("Humanoid")
		local description = humanoid:WaitForChild("HumanoidDescription")
		local accessories = description:GetAccessories(true)
		for _, accessory in ipairs(accessories) do
			local assetId = accessory.AssetId
			local success, result = pcall(function()
				return marketplace:GetProductInfo(assetId)
			end)

			if success then
				if result then
					if result.Creator.Name ~= "Roblox" then
						local success2, result2 = pcall(function()
							return insert:LoadAsset(assetId)
						end)
						
						if success2 then
							if result2 then
								local accessory = result2:FindFirstChildOfClass("Accessory")
								if accessory then
									local characterAccessory = character:FindFirstChild(accessory.Name)
									if characterAccessory then
										characterAccessory:Destroy()
									end
								end
								result2:Destroy()
							end
						else
							warn(result2)
						end
					end
				end
			else
				warn(result)
			end
		end
	end)
end)

A little more convoluted but here’s the fix.

2 Likes

lol thanks for perfect solution