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

Detecting If A Player Has Brought A Developer Product Has Been Brought Not Working?

Asked by 3 years ago

For Some Reason My Script Isnt Working And I Did Get It From A Tutorial But An Error Occurs.

The Error Is On My Server Script On Line 6 Saying "Missing Argument 1 Or Nill

It Is Located In ServerScriptService Here Is My Server Script

01local MarketplaceService = game:GetService("MarketplaceService")
02 
03local productID = 1174420470
04 
05local function procces (receiptInfo)
06    local Plr = game.Players:GetPlayerByUserId(receiptInfo.UserId)
07    if Plr then
08        print("Yes")
09    else
10        return Enum.ProductPurchaseDecision.NotProcessedYet
11    end
12 
13    return Enum.ProductPurchaseDecision.PurchaseGranted
14end
15 
16MarketplaceService.ProcessReceipt = procces

Here Is My Client Script

1wait(5)
2local MarketplaceService = game:GetService("MarketplaceService")
3local Players = game:GetService("Players")
4 
5local productID = 1174420470  -- Change this to your developer product ID
6 
7-- Function to prompt purchase of the developer product
8local player = Players.LocalPlayer
9MarketplaceService:PromptProductPurchase(player, productID)

1 answer

Log in to vote
0
Answered by 3 years ago

Try?

01-- button script
02MPS = game:GetService("MarketplaceService")
03id = 468786137 -- replace with your ID
04local player = game.Players.LocalPlayer
05 
06script.Parent.MouseButton1Click:connect(function()
07 MPS:PromptProductPurchase(player, id)
08end)
09 
10 --  Script In ServerScriptService:
11 
12local MPS = game:GetService("MarketplaceService")
13 
14MPS.ProcessReceipt = function(receiptInfo)
15 if receiptInfo.ProductId == 0 then -- replace "0" with your ID
View all 23 lines...
Ad

Answer this question