Months after I've been introduced to data stores, I still don't understand how to use them. I tried this script in Workspace in studio, and the output just tells me that "An error occurred." In the test server, it tells me absolutely nothing. I have no idea what I'm doing wrong here.
datastore = game:GetService("DataStoreService"):GetDataStore("PlayerData by UserID") http = game:GetService("HttpService") http.HttpEnabled = true Default = { ["Level"] = 1, ["Gold"] = 100, ["AdminStatus"] = "User" } JCodedDefault = http:JSONEncode(Default) game.Players.PlayerAdded:connect( function(player) print("Attempting to access "..player.Name.."'s data...") wait(3) if not datastore:GetAsync(player.userId) then print(player.Name.."'s data has not been found. Attempting to write default data...") wait(3) datastore:SetAsync(player.userId, JCodedDefault) if datastore:GetAsync(player.userId) then print("Successful.") else print("Failed.") end else print("Successful.") end end )
you did postasync, maybe it's setasync?