After a time debugging a code to prompt a devproduct purchase in my game, i noted the following error right on connection, even in a place of the game with no code involving devproducts purchases:
Model.MainModule:701: attemp to index field 'DevProducts' (a nil value) edit: a image of the error: https://imgur.com/a/ZRo58Hk
The prompt itself is working, the devproduct can be buyed, but the response when a player buys isnt launched; neither with .PromptPurchaseFinished or .ProcessReceipt https://imgur.com/a/05Mb5Kg
can anyone confirm if devproducts are working fine, or can put a tut or something? i've followed the official wiki and a pair of yt tutorials with no result. Thank you
edit: the code actually have this form:
---[[ this code is on a part with a click detector ]]-- local code = 384995071 local market = game:GetService("MarketplaceService") local playerIn = nil --code to prompt the buy script.Parent.ClickDetector.MouseClick:connect(function(player) if (player ~=nil) then game:GetService("MarketplaceService"):PromptProductPurchase(player, code ) playerIn = player end end)
---[[ this code is on a part in workspace ]]-- local MarketplaceService = game:GetService("MarketplaceService") local devproductid = 384995071 --locales local cofre = game.ReplicatedStorage.Treasures["Robux Chest 10k"] local PlayerStatManager = require(game.ServerStorage.DataStoreAnimals) -- Set the callback; this can only be done once by one Script on the server! MarketplaceService.ProcessReceipt = function(receiptInfo) for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == devproductid then print("si comprado") --give things to player end end end return Enum.ProductPurchaseDecision.PurchaseGranted end