Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can't access DataStore?

Asked by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

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

Log in to vote
1
Answered by 10 years ago

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

Ad
Log in to vote
0
Answered by 10 years ago

You can't access a data store from a LocalScript. The wiki on Data Stores suggest you can only access data stores from a server script.

Reference: http://wiki.roblox.com/index.php?title=Data_store

Answer this question