In my game I want to script a buying prompt where a player can buy clothes off of a mannequin. I have everything set up for the script to work, but for some reason when I test buying clothes outside of studio on the published game, it would always return "this item is not currently for sale." The image is never of the full item but the decal that the item was based on. I don't know why the script sees my assets as decals instead of clothes. Also, the script can never load in the ImageID, and I don't know why. Help?!?
this script would load in the info from the clothes to a gui
OpenItemCard = game.ReplicatedStorage:WaitForChild("OpenItemCard") function OpenItemCard.OnClientInvoke(ID,Body,ItemType,GroupType) local Asset = game:GetService("MarketplaceService"):GetProductInfo(ID) local InfoBox = Card.InfoBox local ReXxInfoBox = Card.ReXxInfoBox local OutletInfoBox = Card.OutletInfoBox local Price = tostring(Asset.PriceInRobux) local ImageID = tostring(Asset.IconImageAssetId) local function GetItemInfo() Card.InfoBox.Header.ItemName.Text = Asset.Name Card.ReXxInfoBox.Header.ItemName.Text = Asset.Name Card.OutletInfoBox.Header.ItemName.Text = Asset.Name Card.Price.Text = Price.."R$" Card.ItemImage.Image = ImageID Card.Creator.Text = Asset.Creator.Name Card.ItemInfo.Text = Asset.Description print("Gathered Item Info for Card: "..Asset.Name) end end local function TransferID() Card.ID.Value = ID print("Transferred Clothing ID: "..ID) end
script inside the mannequin
Adornee = script.Parent.Parent.Parent.AdorneeAnchor ID = string.sub(script.Parent.Parent.Parent.Body.Shirt.ShirtTemplate, 14) -- change if it does not fit the correct type of clothing ItemType = 1 --(1 for shirts, 2 for pants) GroupType = 1 --(1 for ReXx Studios, 2 for ReXx Outlet, 3 for Other) script.Parent.MouseClick:Connect(function(plr) print("Click Detected") game.ReplicatedStorage.OpenItemCard:InvokeClient(plr, ID, Adornee, ItemType, GroupType) print("ItemCard Loaded") end)
Script inside the ImageButton
script.Parent.MouseButton1Click:connect(function() local ID = script.Parent.Parent.Parent.ID.Value local player = game.Players.LocalPlayer game:GetService("MarketplaceService"):PromptPurchase(player,ID) end)
That's because the Shirt/Pants template is not the shirt displayed on the catalog. It's actually the web template that was used to create the shirt, hence why that issue keeps popping up. The best way around this is to store the ID as a Integer value inside the same location where the shirt is and use that instead.
Mannequin Script:
Adornee = script.Parent.Parent.Parent.AdorneeAnchor ID = script.Parent.Parent.Parent.Body.Shirt.Id.Value -- Make sure to create an IntValue named 'Id' in the correct location! ItemType = 1 --(1 for shirts, 2 for pants) GroupType = 1 --(1 for ReXx Studios, 2 for ReXx Outlet, 3 for Other) script.Parent.MouseClick:Connect(function(plr) print("Click Detected") game.ReplicatedStorage.OpenItemCard:InvokeClient(plr, ID, Adornee, ItemType, GroupType) print("ItemCard Loaded") end)