For some reason when I purchase a developer product the money is given to me in studio, but when I purchase it in-game it doesn’t give the money
Serverside:
local function processReceipt(receiptInfo)
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if purchaseHistory[receiptInfo.PurchaseId] then
return Enum.ProductPurchaseDecision.PurchaseGranted
end
local productId = receiptInfo.ProductId
local productInfo = ProductDefinitions[productId]
if productInfo then
CurrencyManager.AddMoney(player, productInfo.Reward)
purchaseHistory[receiptInfo.PurchaseId] = true
local data = DataStoreManager.GetPlayerData(player)
AnalyticsService:LogEconomyEvent(
player,
Enum.AnalyticsEconomyFlowType.Source,
"Money",
productInfo.Reward,
data.Money + productInfo.Reward,
Enum.AnalyticsEconomyTransactionType.IAP.Name,
productInfo.Name
)
MoneyPurchaseEvent:FireClient(player, productInfo.Reward)
return Enum.ProductPurchaseDecision.PurchaseGranted
else
NotificationManager.SendNotification(player, "Purschase Failed. Please Try Again.")
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
MarketplaceService.ProcessReceipt = processReceipt
Clientside:
local function setupButtons()
for buttonName, productInfo in pairs(productButtons) do
local productType = productInfo.Type
local productId = productInfo.Id
local button = purchasableMoneyFrame:FindFirstChild(buttonName)
if button and button:IsA("ImageButton") then
local amountLabel = button:FindFirstChild("Amount")
if amountLabel and amountLabel:IsA("TextLabel") then
local productInfo = ProductDefinitions[productId]
if productInfo then
amountLabel.Text = "+" .. tostring(productInfo.Reward)
else
amountLabel.Text = "Product Not Found"
end
end
button.MouseButton1Click:Connect(function()
print(`Purchase button click. player: {player}, productId: {productId}`)
if productType == "GamePass" then
print(`PromptGamePassPurchase. player: {player}, productId: {productId}`)
MarketplaceService:PromptGamePassPurchase(player, productId) -- This
else
print(`PromptProductPurchase. player: {player}, productId: {productId}`)
MarketplaceService:PromptProductPurchase(player, productId) -- This
end
end)
else
warn(buttonName .. " Wasn't found or is not an Imagelabel.")
end
end
end
Heres the output: Players.< Player >.PlayerGui.UserInterface.PurchasableMoney.PurchasableClient:61: do not run what you just ran (vulnerable function).