local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
MarketplaceService.ProcessReceipt = function(receiptInfo)
local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId
if PurchaseHistory:GetAsync(playerProductKey) then
return Enum.ProductPurchaseDecision.PurchaseGranted
end
for i, plr in ipairs(game.Players:GetPlayers()) do
if plr.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == id then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value +1000
end
end
end
PurchaseHistory:SetAsync(playerProductKey, true)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
I didn't code this, I've been messing around with a code from the wiki; http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService
I know what it does and what it should do.
When I buy the DevProduct, it shows in console(f9) Cannot access DataStore from this client.
Does anyone know a solution?
Screenshot of error: http://prntscr.com/88yisp

1 comment
Thank you very much..... I am happy I learned about these... Now I don't need values for contacting the local screen GUIs