So i made a dev product (UI) but i can't get "ProcessReceipt" in a local script so i so i used a remote event but it says
"Receipt info a nil value" (in regular script)
and i don't know how to fix it
script in workspace (regular) btw. code: (script in worksace) V
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function() local market = game:GetService("MarketplaceService") function market:ProcessReceipt(ReceiptInfo) local player = game.Players:GetPlayerByUserId(ReceiptInfo.PlayerId) if ReceiptInfo.ProductId == 12345 then player.Character.Humanoid.WalkSpeed = 50 end end end)
local script under text button (remote event in ReplicatedStorage) btw.
local Player = game.Players.LocalPlayer local id = 12345 local market = game:GetService("MarketplaceService") local rem = game.ReplicatedStorage.RemoteEvent script.parent.TextButton.MouseButton1Click:Connect(function() market:PromptProductPurchase(Player,id) game.ReplicatedStorage.RemoteEvent:FireServer() end)
Your first problem is that the MarketplaceService.ProcessReceipt assignment happens inside a RemoteEvent callback.
From the ProcessReceipt page, in bright yellow:
As with all callbacks, this function should be set once and only once by a single
[Script](https://developer.roblox.com/api-reference/class/Script)
. If you're selling multiple products in your game, this callback must handle receipts for all of them.
then again in the sample code:
-- Set the callback; this can only be done once by one script on the server! MarketplaceService.ProcessReceipt = processReceipt
The possible second problem is the syntax you used. The example is assigned with a dot notation; not a colon.
local function processReceipt(receiptInfo) -- do what you need with receiptInfo end MarketplaceService.ProcessReceipt = processReceipt