This script is supposed to add whoever bought the developers product add "Money" to the leaderboard. I got this script from the roblox wiki and edited it a little
--LocalScript in StarterPack -- setup local variables local buyButton = game.StarterGui.Donations.DonationAmounts.Donate50Tx local productId = 20806015
-- when player clicks on buy brick prompt him/her to buy a product buyButton.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId) end)
--Script in BuyButton part -- setup local variables local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") local productId = 20806015
-- define function that will be called when purchase finished MarketplaceService.ProcessReceipt = function(receiptInfo)
-- find the player based on the PlayerId in receiptInfo
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
-- check which product was purchased
if receiptInfo.ProductId == productId then
-- handle purchase
player.leaderstats.Money.Value = player.leaderstats.Money.Value + 50
end
end
end
-- record the transaction in a Data Store
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
ds:IncrementAsync(playerProductKey, 1)
-- tell ROBLOX that we have successfully handled the transaction
return Enum.ProductPurchaseDecision.PurchaseGranted
end

1 comment
btw it is not in a local script and it not in the gui that you buy it from