How do i fix this

I need help with this using the MarketplaceService. This keeps returning

  1. 13:18:42.808 ProcessReceipt is a callback member of MarketplaceService; you can only set the callback value, get is not available - Client - LocalScript:11

Help!! Here’s my code.

local MarketplaceService = game:GetService("MarketplaceService")
local ProductId = 1677294795
local plr = game.Players.LocalPlayer

function processReceipt()
    script.Parent.bought:Fire(plr)
end

script.Parent.MouseButton1Click:Connect(function()
    MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer, ProductId)
    if MarketplaceService.ProcessReceipt then processReceipt() end
end)

This is supposed to go on a TextButton inside a UI. the script.Parent.bought:Fire(plr) part is just for hooking it up to a server side script and there let it do the the rest of the job.

2 Likes

You need to use a remoteEvent, not a BindableEvent to communicate with Client-to-Server (change to :FireServer(), no player argument is needed for that)

inside the processReceipt function you need to return a value depending on if the purchase was succesful or incomplete.

return Enum.ProductPurchaseDecision.PurchaseGranted

i think adding this into the function should fix the problem