For a game that I am working on I wanted to have a system where the progress players make can be saved using values inserted into a folder located in the player via the starter player scripts. I thought that I would be able to work this out myself but after making several attempts I'm at a loss. If it isn't any trouble for anyone, I would really like to know what I'm doing wrong with this. Any help would be greatly appreciated, here is the script:
local DataStore = game:GetService("DataStoreService") local ds2 = DataStore:GetDataStore("save data") game.Players.PlayerAdded:connect(function(player) wait() local leader = player.PlayerScripts.Saves local Mining = player.PlayerScripts.Saves ds2:GetAsync(player.UserId).parent = Mining or Instance.new("Part") ds2:SetAsync(player.UserId,leader:getChildren()) Mining.Changed:connect(function() print('Saving Data') ds2:SetAsync(player.UserId,leader:getChildren()) print("Saved") end) end)