so after player exit/reset character, the value will be reset.
I have tried example on “DEVELOPER PRODUCTS EXAMPLE” section but everytime I run the variable always increment.
for example: datastore.Value.Inventory["Key 1"] = 1 --this variable always increment
How should I delete playerData completely?
In the process of development, I often delete and clean player data.
But this module cannot delete player data, even though used module’s Remove method and set value nil.
I also tried to delete in RunMode, but some old data coming back.
Does this module work in this situation?
-- if we are in studio stop the datastore from saving
if game:GetService("RunService"):IsStudio() then
datastore.SaveInterval = 0
datastore.SaveOnClose = false
end
If I have used SDM, Do I need to record purchase history as seen on reference below (line 39 - 56):
...
success, errorMessage = pcall(function()
purchased = purchaseHistoryStore:GetAsync(playerProductKey)
end)
-- If purchase was recorded, the product was already granted
if success and purchased then
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif not success then
error("Data store error:" .. errorMessage)
end
-- Determine if the product was already granted by checking the data store
local playerProductKey = receiptInfo.PlayerId .. "_" .. receiptInfo.PurchaseId
local success, isPurchaseRecorded = pcall(function()
return purchaseHistoryStore:UpdateAsync(playerProductKey, function(alreadyPurchased)
if alreadyPurchased then
return true
end
...
And What’s really purpose to record purchase history of developer product?
what I think is happening is
if you return Enum.ProductPurchaseDecision.PurchaseGranted its might not be 100% that this response will reach Roblox. if this happens Roblox might ask you to process a purchase more then once even if you returned Enum.ProductPurchaseDecision.PurchaseGranted
if your not worried about giving a player the same item more then once in this small edge case then you don’t need to record it but if you don’t want to give them the item more then once then you would need to record it just to make sure