i see your script.
if youre using a gamepass:
1 | local productId = 1138688305 |
2 | game.Players.PlayerAdded:Connect( function (player) |
3 | Game:GetService( "MarketplaceService" ):PromptProductPurchase(player, productId) |
if its a devproduct:
01 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
02 | local Players = game:GetService( "Players" ) |
04 | local productID = 1138688305 |
07 | local function promptPurchase() |
08 | local player = Players.LocalPlayer |
09 | MarketplaceService:PromptProductPurchase(player, productID) |
after that you need to insert another script in serverscriptservice if youre using a devproduct to get the robux... you forgot that.
but you have to add a benifit for that donation. how about 1 gold(lol)?
01 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
02 | local DataStoreService = game:GetService( "DataStoreService" ) |
03 | local Players = game:GetService( "Players" ) |
06 | local purchaseHistoryStore = DataStoreService:GetDataStore( "PurchaseHistory" ) |
09 | local productFunctions = { } |
11 | productFunctions [ 1138688305 ] = function (receipt, player) |
13 | local stats = player:FindFirstChild( "leaderstats" ) |
14 | local gold = stats and stats:FindFirstChild( "Gold" ) |
16 | gold.Value = gold.Value + 1 |
24 | local function processReceipt(receiptInfo) |
27 | local playerProductKey = receiptInfo.PlayerId .. "_" .. receiptInfo.PurchaseId |
28 | local purchased = false |
29 | local success, errorMessage = pcall ( function () |
30 | purchased = purchaseHistoryStore:GetAsync(playerProductKey) |
33 | if success and purchased then |
34 | return Enum.ProductPurchaseDecision.PurchaseGranted |
35 | elseif not success then |
36 | error ( "Data store error:" .. errorMessage) |
40 | local player = Players:GetPlayerByUserId(receiptInfo.PlayerId) |
44 | return Enum.ProductPurchaseDecision.NotProcessedYet |
48 | local handler = productFunctions [ receiptInfo.ProductId ] |
51 | local success, result = pcall (handler, receiptInfo, player) |
52 | if not success or not result then |
53 | warn( "Error occurred while processing a product purchase" ) |
54 | print ( "\nProductId:" , receiptInfo.ProductId) |
55 | print ( "\nPlayer:" , player) |
56 | return Enum.ProductPurchaseDecision.NotProcessedYet |
60 | local success, errorMessage = pcall ( function () |
61 | purchaseHistoryStore:SetAsync(playerProductKey, true ) |
64 | error ( "Cannot save purchase data: " .. errorMessage) |
68 | return Enum.ProductPurchaseDecision.PurchaseGranted |
72 | MarketplaceService.ProcessReceipt = processReceipt |
note: roblox does not handle these devproduct purchases, so you must NOT alter the core script. you do not need the above script for a gamepass.