Argument 1 missing or nil

Sadly, purchaseInfo doesn’t return its Asset Icon ID. Please just re-check what it returns here: MarketplaceService.ProcessReceipt

You indeed have to fetch the ProductInfo from MarketPlaceService. @Wildcutepenguin, just try my solution out in case you missed it out.

1 Like

Yeah, my confused mind.

Don’t forget to add the RemoteEvent though.

Just so everyone is on the same page, this is what my script looks like. currently*

local MarketplaceService = game:GetService("MarketplaceService")
local GetProductInfo = MarketplaceService.GetProductInfo
local debounce = false

game.ReplicatedStorage.SendText.OnServerEvent:Connect(function(player, box, text)
	box.Text = text
end)

MarketplaceService.ProcessReceipt = function(purchaseInfo)
	local plr = game:GetService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId)
	if purchaseInfo.ProductId == 1167909680 and debounce == false then
		debounce = true
		print("24 HOUR ADVERT bought.")
		local ID = tonumber(plr.PlayerGui.AdGui.Frame.TextBox.Text)
		local success, response = pcall(function()
			return MarketplaceService:GetProductInfo(ID)
		end)
		if success then
			game.Workspace.AdvertBoard.SurfaceGui.Frame.Template.Image = "rbxassetid://"..ID
		else
			warn(response)
		end
		wait(1)
		debounce = false
	elseif purchaseInfo.ProductId == 1167909777 and debounce == false then
		debounce = true
		print("THREE DAY ADVERT bought.")
		wait(1)
		debounce = false
	elseif purchaseInfo.ProductId == 1167909888 and debounce == false then
		debounce = true
		print("30 DAY ADVERT bought.")
		wait(1)
		debounce = false
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

This only works for decals, not thumbnails of clothing or games.
@ProBaturay @0V_ex @Brickman808

Sorry for the late response. Try this

local ID = tonumber(plr.PlayerGui.AdGui.Frame.TextBox.Text)
local asset
local success, response = pcall(function()
    asset = MarketplaceService:GetProductInfo(ID)
end)

if success then
    game.Workspace.AdvertBoard.SurfaceGui.Frame.Template.Image = asset.IconImageAssetId
else
	warn(response)
end

That’s ok but the script still doesn’t work. :confused:

Instead

"rbxassetid://" .. asset.IconImageAssetId

Yes! We have a solution finally.
It only works on games, is there any way for it to work for clothing too?

1 Like

What do you mean by clothing? Are you trying to dress a body up?

No, I just want them to be able to advertise games, shirts and pants.