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

Not giving the money from the Developer Product?

Works, but when they buy they get no money?

--

local devProductId = 33890734	--The Developer Product ID if your item, must be a Product of the game place it is in
local player= script.Parent.Parent.Parent.Parent.Parent

--Well, as always, don't touch anything below if you have no idea what you are doing--

--Prompt Buy--
script.Parent.MouseButton1Click:connect(function()
	game:GetService("MarketplaceService"):PromptProductPurchase(player, devProductId)
end)

--Transaction--
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
MarketplaceService.ProcessReceipt = function(receiptInfo)
	for i, player in ipairs(game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == devProductId then		--you can put the event here, or whatever
				local L = game.ServerStorage.MoneyStorage[player.Name]
                     if (L ~= nil) then
                     L.Value = L.Value + 5000 --- Amount of cash goes here.
			end
		end
	end
	local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId
		ds:IncrementAsync(playerProductKey, 1)	
	return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	end

2 comments

0

Try in pairs but tbh i cant see any error in the script. Try checking values and if the variables are correct.

0

idk why it isnt working like for real.

1 answer

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