As the title says, when I test my devproduct money script, sometimes it gives me the money. Sometimes it doesn’t. I’ve been working on it but I can’t find any reason why it works sometimes and sometimes it won’t work.
serverscript
local marketplace = game:GetService("MarketplaceService")
marketplace.ProcessReceipt = function(recieptinfo)
local player = game.Players:GetPlayerByUserId(recieptinfo.PlayerId)
if player then
if player.BannanaStats and player.BannanaStats.Bannans then
if recieptinfo.ProductId == 1352707466 then
player.BannanaStats.Bannans.Value = player.BannanaStats.Bannans.Value + 250
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
end
purchase script in text button
local id = 1352707466
local player = game.Players.LocalPlayer
local mps = game:GetService("MarketplaceService")
script.Parent.MouseButton1Click:Connect(function()
mps:PromptProductPurchase(player, id)
end)```
Try debugging your if statements to see if there is an issue with certain purchases. IE:
local player = game.Players:GetPlayerByUserId(recieptinfo.PlayerId)
if player then
if player.BannanaStats and player.BannanaStats.Bannans then
if recieptinfo.ProductId == 1352707466 then
player.BannanaStats.Bannans.Value = player.BannanaStats.Bannans.Value + 250
return Enum.ProductPurchaseDecision.PurchaseGranted
else
print("Error 3")
end
else
print("Error 2")
end
else
print("Error 1")
end
This will help you identify if an if-statement block is preventing some of the purchases.
I’ve also been told that dev products don’t always work.
You should use Events, MarketplaceService.ProcessReceipt.Connect is the best way to connect a receipt info. local marketplace = game:GetService(“MarketplaceService”)
marketplace.ProcessReceipt = function(recieptinfo) – MarketplaceService.ProcessReceipt.Connect is the best way to connect a receipt info.
local player = game.Players:GetPlayerByUserId(recieptinfo.PlayerId)
if player then
if player.BannanaStats and player.BannanaStats.Bannans then
if recieptinfo.ProductId == 1352707466 then
player.BannanaStats.Bannans.Value = player.BannanaStats.Bannans.Value + 250
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
end