Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't marketplace service work?

Asked by 4 years ago
Edited 4 years ago

I made a donate button and my friend tested it out. He payed and lost the robux but nothing shoed up in my account. It has been 17 hours, here is the code I am using:

1MPS = game:GetService("MarketplaceService")
2id = 1138688305
3local player = game.Players.LocalPlayer
4 
5script.Parent.MouseButton1Click:Connect(function()
6    MPS:PromptProductPurchase(player, id)
7end)
1
Why are you doing this on the client? This is the most ineffective way to get any user a gamepass, or an item for that matter. Prompt the purchase on the server. DeceptiveCaster 3761 — 4y
0
erm mate, you did not get the robux you mean? Read this article, you need to wait 3-7 days: https://devforum.roblox.com/t/incoming-adjustment-to-pending-sales-waiting-period/832724 imKirda 4491 — 4y

1 answer

Log in to vote
0
Answered by
Hafrew 16
4 years ago

i see your script. if youre using a gamepass:

1local productId = 1138688305
2game.Players.PlayerAdded:Connect(function(player)
3    Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
4end)

if its a devproduct:

01local MarketplaceService = game:GetService("MarketplaceService")
02local Players = game:GetService("Players")
03 
04local productID =  1138688305 -- Change this to your developer product ID
05 
06-- Function to prompt purchase of the developer product
07local function promptPurchase()
08    local player = Players.LocalPlayer
09    MarketplaceService:PromptProductPurchase(player, productID)
10end

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)?

01local MarketplaceService = game:GetService("MarketplaceService")
02local DataStoreService = game:GetService("DataStoreService")
03local Players = game:GetService("Players")
04 
05-- Data store for tracking purchases that were successfully processed
06local purchaseHistoryStore = DataStoreService:GetDataStore("PurchaseHistory")
07 
08-- Table setup containing product IDs and functions for handling purchases
09local productFunctions = {}
10-- ProductId 1138688305 for
11productFunctions[1138688305] = function(receipt, player)
12    --we do this because there has to be some benefit in a devproduct.
13    local stats = player:FindFirstChild("leaderstats")
14    local gold = stats and stats:FindFirstChild("Gold")
15    if gold then
View all 72 lines...

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.

Ad

Answer this question