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

How to I make 1 dev product do a something different than the other products?

So I am using a donation board and there is already a script inside of it looking for the product when it's bought.

Tbh I don't know what I am doing. Maybe one of u guys can help.

function ReceiptHandler()
	warn("Donation Board: ProcessReceipt Activated")
	game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo)
		local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
		local numberBought = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory"):IncrementAsync(playerProductKey, 1)
		local ProductBought = game:GetService("DataStoreService"):GetDataStore("PurchaseHistoryCount"):IncrementAsync(receiptInfo.ProductId, 1)
		local PlayerFound = false
	local players = game.Players:GetPlayers()

	local currency = "Stage"

		local done = 0
		for i, v in pairs (game.Players:GetChildren()) do
			if v:IsA('Player') then
				if v.userId == receiptInfo.PlayerId then
				for _, p in pairs (Products.Products) do
					for i=1,#players do
						if players[i].userId == receiptInfo.PlayerId then
							if receiptInfo.ProductId == 978487374 and done == 0 then
								done = 1
								players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 1
								players[i].TeleportedStage.Value = players[i].TeleportedStage.Value + 1
								players[i].Character.Humanoid.Health = 0
								done = 0
								PlayerFound = true
						if p.ProductId == receiptInfo.ProductId then
							if v ~= nil then
								PlayerFound = true
								game:GetService("DataStoreService"):GetOrderedDataStore(GetData()):IncrementAsync(receiptInfo.PlayerId, p.ProductPrice)
								end
							end
						end
					end
				end
			end
		end
	end
end

1 answer

Probably something like this:

if players[i].userId == receiptInfo.PlayerId then
                            if receiptInfo.ProductId == 978487374 and done == 0 then
                                done = 1
                                players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 1
                                players[i].TeleportedStage.Value = players[i].TeleportedStage.Value + 1
                                players[i].Character.Humanoid.Health = 0
                                done = 0
                                PlayerFound = true
                        if p.ProductId == receiptInfo.ProductId then
                            if v ~= nil then
                                PlayerFound = true
                                game:GetService("DataStoreService"):GetOrderedDataStore(GetData()):IncrementAsync(receiptInfo.PlayerId, p.ProductPrice)
                                end
                            end
                        end

you copy paste this under this exact script and you change the Developer Product Id 978487374 and then in the lines below that you change what ever u want the developer product to do for example u can change Humanoid Speed,Health,JumpPower and more

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