-
What do you want to achieve?
I would like to only get the AssetID from the HumanoidDescription AccessoryBlob Property; however, with my limited knowledge about scripting, I’m not sure how to go about doing so.
In the HumanoidDescription AccessoryBlob Property, it has the following text:
[{"AssetId":10713780551,"Order":2,"AccessoryType":"Jacket"},
{"AssetId":12542070940,"Order":0,"AccessoryType":"Pants"},
{"AssetId":12808482080,"Order":1,"AccessoryType":"Sweater"}]
So, in short, how can I make it so the script ignores all the other text besides the Asset ID?
-
What is the issue?
I’m not exactly sure how to do this since I’m quite new to scripting -
What solutions have you tried so far?
I’ve tried writing following script, but it doesn’t work
local Accessories = {}
... --Other code handling the other accessories are here, but to save space I did not include it!
local AccessoryBlobs = NPC.Humanoid:WaitForChild("HumanoidDescription").AccessoryBlob
local AccessoryBlobsTable = AccessoryBlobs:split(",")
for _, AccessoryBlob in ipairs(AccessoryBlobsTable) do
if AccessoryBlob ~= 0 then
if tonumber(AccessoryBlob) then
table.insert(Accessories, AccessoryBlob)
end
end
end
... --Other code handling the other accessories are here, but to save space I did not include it!
local AddedTable = {}
for _, ID in ipairs(Accessories) do
if ID ~= 0 then
if tonumber(ID) then
if not table.find(AddedTable, ID) then
table.insert(AddedTable, ID)
local Template = script.Template
local NewTemplate = Template:Clone()
NewTemplate.ProductIDVal.Value = ID
NewTemplate.AssetIcon.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=" .. ID .. "&width=420&height=420&format=png"
NewTemplate.Parent = script.Parent.ScrollingFrame
end
end
end
end
end)