Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can't access DataStore?

In a script, I have this Disclaimer GUI pop up. Within that is a text button that says 'I AGREE'. Everything is fine. Then, I have the Developer Product item pop up for them to purchase, and the transaction is fine. The error is that I'm not recieving the item you're supposed to get. Here's a portion from the script:

local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") -- error occurs here
MarketplaceService.ProcessReceipt = function(receiptInfo) 
		if p.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == id then
--extra stuff here. No problem below this

The error is:

"DataStore can't be accessed from client"

It's a LocalScript Tips?

2 answers

✓ Accepted answer

DataStore cannot be accessed from LocalScripts only regular Scripts. Try using a RemoteFunction if you want it to work correctly.

This discussion is preserved as it was. New answers, comments, and votes are closed.