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
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