local DS = game:GetService("DataStoreService")-- Creating DataStores To Save Your Data local GoldSave = DS:GetDataStore("GoldSaveSystem") -- game.Players.PlayerAdded:Connect(function(Player) -- When A Player Joins local Folder = Instance.new("Folder",Player) -- New Folder Inside Player Called "leaderstats" Folder.Name = "leaderstats" -- local Gold = Instance.new("IntValue",Folder) -- Making A Value Inside The Player Named "Gold" Gold.Name = "Gold" -- Gold.Value = GoldSave:GetAsync(Player.UserId) or 0 -- Gold.Changed:Connect(function() -- Saves Their Gold If They Earn Any GoldSave:SetAsync(Player.UserId, Gold.Value) -- end) -- -- If The XP Changes It Will Call The LevelUp Function end) game.Players.PlayerRemoving:Connect(function(Player)-- Saving Their Level Value -- Saving Their XP Value GoldSave:SetAsync(Player.UserId, Player.leaderstats.Gold.Value) -- Saving Their Gold Value end) --
So, i have a datastore that is not saving. The loading is working as i went on the DataStore editor and it loads perfectly. But when i edit the data in leaderstats expecting it to save. It goes back to the values i inserted in datastore editor
I've had the exact same problem with datastores, however, the only one which worked for me was
local DataStore = game:GetService("DataStoreService") local ds = DataStore:GetDataStore("WaveSaveSystem") game.Players.PlayerAdded:connect(function(player) local Wave = Instance.new("IntValue",player) Wave.Name = "Diamond" Wave.Value = ds:GetAsync(player.UserId) or 1 Wave.Changed:connect(function() ds:SetAsync(player.UserId, Wave.Value) end) end) game.Players.PlayerRemoving:connect(function(player) ds:SetAsync(player.UserId, player.Wave.Value) end)