As the title introduced the subject, I am fixing a system (made from someone else) which loads assets of your character into a ui. Inside this UI you are supposed to be able to remove the respective asset - but to do this I need to search in the character with the name of the button (that visually represents the asset). The issue I am facing is that I looked inside my character’s model and the assets’ names were completely incorrect. I have not altered them at all so this issue shouldn’t even have occurred?
Edit: I have recently been informed that it is iNTentiOnal. Do you guys have any suggestions on how to align the names then?
What what I understand you’re facing an issue with getting the correct name from an asset on a character because (I’m making up asset names for an example) the asset could have a name in the Catalog as Orange Pineapple Helmet but be named in the character as Orange_pine_hat? Is that what you’re saying, I just want to confirm in order to go deeper into what a solution could be.
With some MarketplaceService magic, and exactly the :GetProductInfo() method, you can get the actual asset’s name that’s shown on the page. This method returns a table with a bunch of keys, the one you want is Name.
local HatId = --the hat id
local MarketplaceService = game:GetService("MarketplaceService")
local name = MarketPlaceService:GetProductInfo(HatId).Name
Assets uploaded on Roblox aren’t necessarily named in correspondence to their name that appears on the Catalog.
You can use GetCharacterAppearanceInfoAsync which returns a dictionary of the assets equipped on a player. From this, you can insert each of the assets and match the inserted asset’s name to the asset worn on their character.
Go inside the character and look at all of the accessories in the character. The hat’s should be in a ClassName of Accessory. Send a screenshot of what’s inside the character. (I would give an example but my Roblox Studio is broken, If it opens I’ll update this reply with an example.)
I’m trying to see the contents of the character for what you’re use example was. I just want to see what accessory’s are in the character and go from there.
I don’t believe that is necessary.
I can however explain how the script functions and why it won’t work.
The script takes use of GetCharacterAppearanceInfoAsync to get a table of assets in which the character is wearing. Then it instances buttons to represent the assets into a UI for the player to see.
These buttons now have the option to be removed, and when the event that is connected to that function is triggered; it will loop through the character in an attempt to find the asset inside the character.