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

DataStore not Saving?

Asked by 10 years ago

So I'm working on a DataStore system which loads the player's data when they join and save it when they leave or when the server shuts down. The problem is that when testing the game online, the data doesn't save. I'm not playing with anyone so I don't know if it's the game.OnClose function. I receive no errors in the console too. The code is below, if you could help it would mean a lot to me.

Please take note that this isn't the full script.

01local datastore = game:GetService("DataStoreService")
02 
03-- When the Player Joins
04 
05game.Players.PlayerAdded:connect(function(Player)
06    Setup_Leaderstats(Player)
07    Setup_StoreStats(Player)
08    LoadData(Player, Player:FindFirstChild("leaderstats"))
09end)
10 
11-- Functions
12 
13function Setup_StoreStats(Player)
14    local Skins = replicatedstorage.Resources:FindFirstChild("Skins")
15    -- Create Storage
View all 75 lines...
0
Try adding a wait after the for loop, the game might be closing before it saves data. bobafett3544 198 — 10y

Answer this question