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

Need Help Using Developer Products

Asked by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

Ok. So, I have this Developer product for my game, and I'm using it to buy a house. I DON'T want the game to remember they bought it, so they have to buy it again if they rejoin (That's why I don't need Data Store). Here's my script so far.

local CD = script.Parent.Main.ClickDetector --Click Detector (Don't need to change)
id = 19334843 --Developer Product ID
CD.MouseClick:connect(function(plr)
    if script.Parent.Owner.Value == "Nobody" then
        game:GetService("MarketplaceService"):PromptProductPurchase(plr, id) --Makes them buy it
        local MarketplaceService = game:GetService("MarketplaceService")
MarketplaceService.PromptPurchaseFinished:connect(function(plr, id, isPurchased)
    if isPurchased then
script.Parent.Owner.Value = plr.Name
    end
end)
    end
end)

It doesn't work. Any tips?

1
I, so far, have only cleaned the code up a little bit, but don't see a real cause for this problem. Does the output not say anything? TheMyrco 375 — 10y

1 answer

Log in to vote
-3
Answered by 10 years ago

Its easier with data stores, And these relate to data stores.Please up vote and, Goodluck

Hint: ROBLOX itself does not record the purchase record of developer products by users. It is the game developer's responsibility to track this, typically with Data Stores.

Server Sided Code:

local MarketplaceService = Game:GetService("MarketplaceService")

MarketplaceService.ProcessReceipt = function(receiptInfo)
    game.Workspace.DisplayScreen.SurfaceGui.TextBox.Text = receiptInfo.PlayerId .. " just bought " .. receiptInfo.ProductId
    -- ...
    -- use DataStore to record purchase
    -- ...  
    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

Client Sided Code:

local MarketplaceService = Game:GetService("MarketplaceService")
local buyButton = game.Workspace.BuyButton.SurfaceGui.TextButton
local productId = 13672652

buyButton.MouseButton1Click:connect(function()
    MarketplaceService:PromptProductPurchase(player, productId)
end)
0
I read the forum post. You posting the scripts that they provide isn't helping. I asked for somebody to fix my script. Shawnyg 4330 — 10y
Ad

Answer this question