I need help prompting purchase from the template id

I am scripting for a Homestore that has a bunch of clothing stands with the shirt templates.

My issue is that I am not able to prompt purchase from the shirt or pants its self and I need a little help.
The only thing I am provided is this
image

I tried to look up all over the internet for the solution for this issue but nothing has come up.

NOTE: I want to get the product with roblox lua not manually.

So as I am understanding, your goal is to make the player buy the product. My suggestion is to use MarketPlaceService.

local id = -- product id
local plr = game.Players.LocalPlayer

game:GetService("MarketplaceService"):PromptPurchase(plr, id)

Put this in a local script.

Also don’t use PromptProductPurchase, use PromptPurchase. If you aren’t already

No, I understand how to use MarketplaceService and PromptPurchase. My issue is that I am provided a template ID and I want to prompt the purchase with just the texture. The texture Id does not work when trying to prompt it as a purchase because it is just an image.

Do you want to prompt purchase with the selected property in the screenshot?

Yes, I want to with that id in the pantstemplate prompt purchase from the catalog.

Oh than I have no clue… Sorry.

Does game:GetService("MarketplaceService"):PromptPurchase(plr, pants.PantsTemplate) not work?

I’d imagine you need to extract just the numbers in which case


tonumber(string.match(Pants.PantsTemplate, "%d+")) 

Should do it

I have already tried that. That isnt the issue you can not prompt purchase with PantsTemplate

I think it is possible. Have you tried this code?

local id = string.split(tostring(script.Parent.PantsTemplate), "=")

print(tonumber(id[2]))

game.Players.PlayerAdded:Connect(function(plr)
	game:GetService("MarketplaceService"):PromptPurchase(plr, tonumber(id[2]))
end)

One problem for me is that it says the product is offsale no matter what, but I think that is a Roblox bug.

1 Like