Suphi's DataStore Module

I’m new to coding…

Is there any way to save data temporary?

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

I tried it On Roblox Studio…

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
1 Like
if datastore.State == true then
    datastore.Value = nil
else
    warn("Datastore is not open we cannot delete the data at this time")
end
1 Like

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?

reference: MarketplaceService | Documentation - Roblox Creator Hub
(ProcessReceipt Callback code example / bottom part)

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

1 Like

I think using local DataStoreModule = require(11671168253) frequently making my Roblox Studio freeze, as seen in below screenshot:

so, I need to click play - stop and play again until my game load…
Any solution to this?

Thank You in advance…

Insert the module and require it instead of the id

Thank You, now it solved! :+1: