Purchase Repetitions for Dev purchases

Hi all

I made dev products for my zombie game to spawn a soldier.

I understand it is meant to support multiple purchases.

However upon purchasing 1 soldier, it continues to spawn in a new separate game session.

The intention is to have player purchase just 1 soldier for that single game session.

Am I doing anything wrong?

Much appreciated.

local productFunctions = {}
productFunctions[XXX] = function(receipt, player)
add marine code
end

productFunctions[YYY] = function(receipt, player)
add combat engineer code
end

local function processReceipt(receiptInfo)

local handler = productFunctions[receiptInfo.ProductId]

local success, result = pcall(handler, receiptInfo, receiptInfo.PlayerId)
if not success or not result then
warn(“Error occurred while processing a product purchase”)
print(“\nProductId:”, receiptInfo.ProductId)
print(“\nPlayer:”, player)
return Enum.ProductPurchaseDecision.NotProcessedYet
end
return Enum.ProductPurchaseDecision.PurchaseGranted

end

MarketplaceService.ProcessReceipt = processReceipt

1 Like

What does a game session mean?

Meaning when a player comes back another day, his previous purchases reappear. Thank you.

1 Like

Is that a one-time purchase?

Use Game Pass for one-time purchases: Passes | Documentation - Roblox Creator Hub

1 Like

No. It’s a multiple. Everytime player needs extra soldiers. He can buy it. The problem is previous purchases will reappear in new games.

1 Like

Save player inventory (soldiers) using a data store

1 Like

But I do not want the soldiers to appear again. It is only for 1 purchase / 1 game. Sorry I am quite new so I may need more details. Thank you.

Then dont use datastores. I dont get what youre saying. Your code doesnt even show the actual problem. The question itself is vague and is not something you can just ask for. The whole process is most likely more than one step and you will end up being spoon fed.

Edit: I remember you posted the same problem before. Why remake the question

I need more information.

Are you using gamepass? If it is dev product, should not previous purchases reappear

My apologies. Because I provided code as requested but I waited a day without reply so I tot maybe it is too buried.

I do not want to be spoon fed but I am having trouble . . How can I help you help me?

Players can buy additional soldiers when needed for the current game session.

If they play another day, the additional soldiers should not be awarded anymore. If he needs, he has to buy again.

The code I pasted is literally the code I have with the exception of the marine code.

Hope this clarifies.

I am using game dev.

That’s y I am stuck. The soldiers bought from past games are reappearing again as if he has purchased again.

:frowning: