EN:
Hello developers! I am a developer of a game on Roblox but we have a big problem. When people buy money from the shops, the script of the recepit dont give them money. This is weird because when I try this on Studio, everything works. Someone know what’s the problem? These are the scripts:
Shop Buttons Script:
local MarketplaceService = game:GetService("MarketplaceService")
local productId = script.Parent.Parent.ProductID.Value -- Change this to your developer product ID
-- Function to prompt purchase of the developer product
script.Parent.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer, productId)
end)
Script in ServerScriptService:
local ProductToQuantity = {
[1831844703] = 10000000,
[1831845742] = 1000000000,
[1831844892] = 50000000,
[1831845035] = 100000000,
-- Add more product IDs and quantities as needed
}
game.Players.PlayerAdded:Connect(function(player)
local Leaderstats = player:WaitForChild("leaderstats")
local function processReceipt(receiptInfo)
local productId = receiptInfo.ProductId
local quantity = ProductToQuantity[productId]
if quantity then
local Leaderstat = Leaderstats:FindFirstChild("Money") -- Change Coins to whatever your currency is
Leaderstat.Value = Leaderstat.Value + quantity
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
game:GetService("MarketplaceService").ProcessReceipt = processReceipt
end)
ITA:
Ciao a tutti developers! Sono un developer di un gioco su Roblox ma abbiamo un grande problema. Quando le persone comprano dei soldi dal negozio tramite dei developer products lo script della “ricevuta” (recepit) non da i soldi ai giocatori. Questo è molto strano perché facendo vari test da Studio tutto funziona perfettamente. Qualcuno potrebbe aiutarmi? Gli script sono questi qui sopra. Grazie!