Are datastoreservice datastores broken?
I have the following savedata script in serverscript service in one of my games:
01 | local AUTO_SAVE = false |
02 | local TIME_BETWEEN_SAVES = 60 |
03 | local PRINT_OUTPUT = false |
04 | local SAFE_SAVE = false |
07 | local players = game:GetService( "Players" ) |
08 | local dataStoreService = game:GetService( "DataStoreService" ) |
09 | local leaderboardData = dataStoreService:GetDataStore( "LeaderStats" ) |
11 | local function Print(message) |
12 | if PRINT_OUTPUT then print (message) end |
15 | local function SaveData(player) |
16 | if player.userId < 0 then return end |
17 | player:WaitForChild( "leaderstats" ) |
19 | local leaderstats = { } |
20 | for i, stat in pairs (player.leaderstats:GetChildren()) do |
21 | table.insert(leaderstats, { stat.Name, stat.Value } ) |
23 | leaderboardData:SetAsync(player.userId, leaderstats) |
24 | Print( "Saved " ..player.Name.. "'s data" ) |
27 | local function LoadData(player) |
28 | if player.userId < 0 then return end |
29 | player:WaitForChild( "leaderstats" ) |
31 | local leaderboardStats = leaderboardData:GetAsync(player.userId) |
32 | for i, stat in pairs (leaderboardStats) do |
33 | local currentStat = player.leaderstats:FindFirstChild(stat [ 1 ] ) |
34 | if not currentStat then return end |
35 | currentStat.Value = stat [ 2 ] |
37 | Print( "Loaded " ..player.Name.. "'s data" ) |
40 | players.PlayerAdded:connect(LoadData) |
41 | players.PlayerRemoving:connect(SaveData) |
44 | game.OnClose = function () |
45 | for i, player in pairs (players:GetChildren()) do |
53 | wait(TIME_BETWEEN_SAVES) |
54 | for i, player in pairs (players:GetChildren()) do |
In the game, it works perfectly. Never had a problem with it, always gets the data right, etc etc.
In the process of building another game, I used the same script (save to roblox, open from mymodels) for this function and the same script that I had in the other game to create the stats.
to shorten: I have this script to save/load and another to create the stats for new players in a game. I have these identical scripts in another game I am building.
My problem is: In the new game (with nothing different) I get this error every time the script tries to load the playerdata on join, and then no other part of the script ever fires:
502: API Services rejected request with error: HTTP 0 (HTTP 403 (HTTP/1.1 403 Forbidden))
My script isn't even trying to connect using an api, it's just connecting to datastore service.
Can anyone tell me what's going on here?!
The line that the error code comes up for is line 38 in the script. The script that has the error is the script attached.