Basically I am trying to make a clothing giver that gives you a certain clothing depending on your rank in a group you are in. When I look at my character’s clothing before I trigger the function that does this, I see the format for the clothing is “http://www.roblox.com/asset/?id=”. However, when I try to go to the marketplace to test this out on other pieces of clothing, the format is different “Catalog - Roblox”. Because of this, the code won’t work. Is there a way for me to find the “http://www.roblox.com/asset/?id=” format.
That’s because the assets have two different identifiers. One for the image and one for the catalog item. To disseminate which is which, let’s give an example!
First, we’ll use this link for reference.
https://www.roblox.com/catalog/3670737444/Roblox-Shirt-Simple-Pattern
Therefore, we’ll use MarketplaceService
to get more information about it:
print(game:GetService("MarketplaceService"):GetProductInfo(3670737444))
{
["AssetId"] = 3670737444,
["AssetTypeId"] = 11,
["ContentRatingTypeId"] = 0,
["Created"] = "2019-08-16T23:51:49.697Z",
["Creator"] = {...},
["Description"] = "",
["IconImageAssetId"] = 0,
["IsForSale"] = false,
["IsLimited"] = false,
["IsLimitedUnique"] = false,
["IsNew"] = false,
["IsPublicDomain"] = true,
["MinimumMembershipLevel"] = 0,
["Name"] = "Roblox Shirt - Simple Pattern",
["ProductId"] = 939909925,
["ProductType"] = "User Product",
["Sales"] = 0,
["TargetId"] = 3670737444,
["Updated"] = "2019-09-26T20:21:34.953Z"
} - Edit
Then, we’ll use a Shirt
instance and input this catalog ID into the ShirtTemplate
! The result should be:
http://www.roblox.com/asset/?id=3670737337
And finally, we’ll print the information about it using MarketplaceService
:
print(game:GetService("MarketplaceService"):GetProductInfo(3670737337))
{
["AssetId"] = 3670737337,
["AssetTypeId"] = 1,
["ContentRatingTypeId"] = 0,
["Created"] = "2019-08-16T23:51:48.563Z",
["Creator"] = ▶ {...},
["Description"] = "Shirt Image",
["IconImageAssetId"] = 0,
["IsForSale"] = false,
["IsLimited"] = false,
["IsLimitedUnique"] = false,
["IsNew"] = false,
["IsPublicDomain"] = false,
["MinimumMembershipLevel"] = 0,
["Name"] = "CityLifeBase-Shirts-R15",
["ProductId"] = 0,
["Sales"] = 0,
["TargetId"] = 0,
["Updated"] = "2019-09-26T20:46:52.557Z"
} - Edit
Notice the AssetTypeId
is different! It’s the same thing as:
https://create.roblox.com/docs/reference/engine/enums/AssetType
To check whether the ID belongs to an actual image or any clothing, ensure it isn’t the first one. It is enumerated as 1, named “Image” in this case. Alternatively, check for ProductId
to ensure it isn’t 0.
So do I have to go through this whole process to find the second identifier you mentioned, or I’m a bit confused. Don’t really see it clearly about what I have to do.
It appears I have overlooked the actual solution. Try using this:
https://create.roblox.com/docs/reference/engine/classes/InsertService#LoadAsset
Using this line:
game:GetService("InsertService"):LoadAsset(3670737444)
It will generate a hierarchy of a Model
over the Shirt
instance. You can check for the item just by Instance.FindFirstChild("Shirt")
or just index it directly. Then you parent it to the characters.