Getting the real shirt ID from Template ID

Hello, i would like to know if there’s a way to get the real ID from a shirt Template Id, as i want to use the MarketplaceService to PromptPurchase on a Shirt Id from a mannequin, and it would return as off sale because it takes the Decal instead, is there a way to somehow get the real ID so i can prompt the purchase on the actual shirt?

The code i am using:

local shirt = mannequin:FindFirstChild("Shirt")
if shirt then
	local shirtClick = script.ShirtClick:Clone()
	local id = tonumber(string.match(shirt.ShirtTemplate, "%d+"))
	shirtClick.ClickDetector.MouseClick:Connect(function(plr)
		market:PromptPurchase(plr,id)
	end)
	shirtClick.CFrame = mannequin.Torso.CFrame
	shirtClick.Parent = mannequin
end

also forgive me for my bad english.

2 Likes

IIRC, aren’t able to get the shirt ID from the decal ID, however you can do the opposite, getting the decal ID from the shirt ID. What I would do instead, is create an IntValue inside of the mannequin and then iterate through all mannequins and give each mannequin the shirt ID to be applied.

For example:

for i,v in pairs(workspace:WaitForChild('Mannequins'):GetChildren()) do
    if v:FindFirstChild('ShirtID') then
        local shirt = v:FindFirstChild('Shirt')
        if not shirt then
            shirt = Instance.new('Shirt')
            shirt.Parent = v -- parent to the mannequin
        end
        shirt.TemplateId = 'rbxassetid://'..v.ShirtID.Value
    else
        warn('No ShirtID value was found inside of '..v.Name..'!')
    end
end

And then for your click detector,

clickDetector.MouseClick:Connect(function(plr)
    local value = clickDetector.Parent:FindFirstChild('ShirtID')
    if value then
        market:PromptPurchase(plr, id)
    end
end

A feature request for this has been created awhile ago but it wasn’t ever addressed.