Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Need Help Using Developer Products

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 comment

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?

1 answer

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)

1 comment

0

I read the forum post. You posting the scripts that they provide isn't helping. I asked for somebody to fix my script.

This discussion is preserved as it was. New answers, comments, and votes are closed.