Here is a dev product script that you can use for any dev product you just have to change what should be done if all requirements are met. I've edited it to suit your needs so you can just copy and paste it but i do suggest you go through it and see what does what and why it's suppose to be that way
01 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
02 | local ds = game:GetService( "DataStoreService" ):GetDataStore( "PurchaseHistory" ) |
03 | local productId = 52874408 |
06 | MarketplaceService.ProcessReceipt = function (receiptInfo) |
08 | for i, player in ipairs (game.Players:GetChildren()) do |
10 | if player.userId = = receiptInfo.PlayerId then |
12 | if receiptInfo.ProductId = = productId then |
14 | player.Credits.Value = player.Credits.Value + 100 |
19 | local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId |
20 | ds:IncrementAsync(playerProductKey, 1 ) |
22 | return Enum.ProductPurchaseDecision.PurchaseGranted |