This does not change the leaderstats. The developer product does successfully purchase. The reason why this is a function inside a function is that I need a way to find the player from the server. This does not give an error. The only problem with this is that it does not change the leaderstats. The prompt for the developer product is inside a part, this script is in ServerScriptService. Both are server scripts.
local MarketplaceService = game:GetService("MarketplaceService")
local devProductRewards = {
[1261860735] = { Reward = 100 },
[1261860764] = { Reward = 250 }
}
game.Players.PlayerAdded:Connect(function(player)
local function processReceipt(receiptInfo)
local boughtProductInfo = devProductRewards[receiptInfo.ProductId] --This is where you get info from the table
print(boughtProductInfo.Reward) --Should print reward, if the id was found in the table.
player.leaderstats.Coins += boughtProductInfo.Reward
end
end)