Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I fix this ID glitch?

Asked by
woodengop 1134 Moderation Voter
9 years ago

When Putting a ID for Shirts and Pants I would Subtract a 1 from the Shirt ID. But when I Subtracted 1 from a ID it become another Shirt. What had happened here? Please Reply.

0
Well when I put down a ID in studio Another Shirt popped out. woodengop 1134 — 9y
0
Try subtracting the ID again, sometimes when uploading a shirt, another will be uploaded at the same time, heres what I mean; Your Shirt (1) > Someones Elses (2) > Full Shirt (3) > Someones Full Shirt (4). TheeDeathCaster 2368 — 9y
0
thanks that worked! woodengop 1134 — 9y

1 answer

Log in to vote
3
Answered by
Merely 2122 Moderation Voter Community Moderator
9 years ago

Most of the time, when you upload a shirt, the shirt image's ID is 1 less, but if multiple people created assets at around the same time, it could have an earlier ID. Keep on subtracting 1 until you find it.

If you want to do this automatically in a game, you can use MarketplaceService's GetProductInfo method to iterate backwards until you find it.

local MarketplaceService = game:GetService("MarketplaceService")
local ShirtID = 114883953
local CreatorName = MarketplaceService :GetProductInfo(ShirtID).Creator.Name
local ImageID = nil

for i = 1, 20 do
    local info = MarketplaceService :GetProductInfo(ShirtID - i)
    print(info.Name)
    if (info and info.Creator.Name == CreatorName) then
        ImageID = ShirtID - i
        break
    end
end

if (ImageID == nil) then
    print("Image not found for Shirt")
else
    print("Found ImageID")
end

Note: This will not work with Group shirts, because the image was uploaded by a user but the shirt is owned by the group.

0
I didn't ask for a Script. woodengop 1134 — 9y
0
I know. Did the first part explain your problem? Merely 2122 — 9y
Ad

Answer this question