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

how do I convert From pants/shirt template ID to asset ID?

Asked by 2 years ago
Edited 2 years ago

So, the title might seem confusing but let me explain:

I just figured out that when you enter a shirt ID/pant ID into a shirt/clothing asset it turns the ID into the template for example I enter this into my pants/clothing asset https://www.roblox.com/catalog/4628693536/nelk-boys-x-champion-black-joggers and it turns the ID into https://www.roblox.com/library/4628693524/nelk-boys-x-champion-black-joggers (These are not my pants, credit to the owner)

I made my entire script by harvesting the ID from the pants/clothing asset, and being able to purchase it when clicking :( But it does not work because the ID in there changes from the ID you see on the catalog persay

Hopefully, this makes sense, and here is my relevant code:

mouse.Button1Down:Connect(function()
    local raw = MouseSelect() --// it was useless the entire time but it was good practice.. till i figured out the ID CHANGES >:( ARGHHHH
    if raw ~= nil then
        local ID = string.match(raw, "%d+")
        print(ID)
        local IDFixed = ID + 8 --// I thought the difference between the template URL and actual URL is by 8 but its wrong
        game:GetService("MarketplaceService"):PromptPurchase(Player, IDFixed) --//Player is localplayer :)
    end
end)

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

By the way the difference is 12. if you are trying to change an ID from a number example 12345678 to rbxassetid://12345678

if you are then it will be like

local ID = 12345678
local NewID = "rbxassetid://"..ID
print(ID.. " is converted to "..NewID)

if this is not what you want to do then i have no idea what you're trying to do.

Ad

Answer this question