Here my Gui button, it works fine and prompts the purchase
local productId = 604433526
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)
And heres my purchase handler for it, that part thats is not working, updating game stats
local DataStore = game:GetService("DataStoreService"):GetDataStore("ProductPurchases")
game:GetService("MarketplaceService").ProcessReceipt = function(ReceiptInfo)
local Purchasing_Player = game.Players:GetPlayerByUserId(ReceiptInfo.PlayerId)
if ReceiptInfo.ProductId == 604433526 then
if Purchasing_Player and Purchasing_Player:FindFirstChild('leaderstats') and Purchasing_Player.leaderstats:FindFirstChild('Money') then
Purchasing_Player.leaderstats.Money.Value = Purchasing_Player.leaderstats.Money.Value + 10000
end
end
DataStore:IncrementAsync(ReceiptInfo.PlayerId .. '_' .. ReceiptInfo.ProductId, 1)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Help greatly appreciated!
