I have this Datastore script that works, however it needs to be changed to a table as the datasave tends to time out.
Here is where the values are located:https://gyazo.com/3ac00ccf52bf748b092974fce64806f6 :https://gyazo.com/d4ab0e289813de593585b8136713c6a9
local DSS = game:GetService("DataStoreService") local PlayerCaps = DSS:GetDataStore("PlayerCaps") local PlayerScrap = DSS:GetDataStore("PlayerScrap") local Player_308cal = DSS:GetDataStore("Player_308cal") local Player_38calC = DSS:GetDataStore("Player_38calC") local Player_44calC = DSS:GetDataStore("Player_44calC") local Player_45calC = DSS:GetDataStore("Player_45calC") local Player_50calC = DSS:GetDataStore("Player_50calC") local Player_5mmC = DSS:GetDataStore("Player_5mmC") local Player_10mmC = DSS:GetDataStore("Player_10mmC") local Player_2mmECC = DSS:GetDataStore("Player_2mmECC") local Player_556mmC = DSS:GetDataStore("Player_556mmC") local Player_9mmC = DSS:GetDataStore("Player_9mmC") local Player_FusionCellC = DSS:GetDataStore("Player_FusionCellC") local Player_PlasmaCartridgeC = DSS:GetDataStore("Player_PlasmaCartridgeC") local Player_ShotgunShellC = DSS:GetDataStore("Player_ShotgunShellC") game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) wait(1) if Player:FindFirstChild("Cash") == nil then local Cloned = script.Cash:Clone() Cloned.Parent = Player end if Player:FindFirstChild("AmmoBag") == nil then local Cloned = script.AmmoBag:Clone() Cloned.Parent = Player end wait(1) local Cash = Player:WaitForChild("Cash") local Caps = Player.Cash:WaitForChild("Caps") local Scrap = Player.Cash:WaitForChild("Scrap") local AmmoBag = Player:WaitForChild("AmmoBag") local CSA = Player.AmmoBag:WaitForChild("CurrentStoredAmmo") local _308calC = CSA:WaitForChild(".308cal") local _38calC = CSA:WaitForChild(".38cal") local _44calC = CSA:WaitForChild(".44cal") local _45calC = CSA:WaitForChild(".45cal") local _50calC = CSA:WaitForChild(".50cal") local _5mmC = CSA:WaitForChild("5mm") local _10mmC = CSA:WaitForChild("10mm") local _2mmECC = CSA:WaitForChild("2mmEC") local _556mmC = CSA:WaitForChild("5.56mm") local _9mmC = CSA:WaitForChild("9mm") local _FusionCellC = CSA:WaitForChild("FusionCell") local _PlasmaCartridgeC = CSA:WaitForChild("PlasmaCartridge") local _ShotgunShellC = CSA:WaitForChild("ShotgunShell") Caps.Value = PlayerCaps:GetAsync(Player.userId) or 0 Scrap.Value = PlayerScrap:GetAsync(Player.userId) or 0 _308calC.Value = Player_308cal:GetAsync(Player.userId) or 100 _38calC.Value = Player_38calC:GetAsync(Player.userId) or 250 _44calC.Value = Player_44calC:GetAsync(Player.userId) or 240 _45calC.Value = Player_45calC:GetAsync(Player.userId) or 120 _50calC.Value = Player_50calC:GetAsync(Player.userId) or 120 _5mmC.Value = Player_5mmC:GetAsync(Player.userId) or 250 _10mmC.Value = Player_10mmC:GetAsync(Player.userId) or 240 _2mmECC.Value = Player_2mmECC:GetAsync(Player.userId) or 50 _556mmC.Value = Player_556mmC:GetAsync(Player.userId) or 500 _9mmC.Value = Player_9mmC:GetAsync(Player.userId) or 240 _FusionCellC.Value = Player_FusionCellC:GetAsync(Player.userId) or 300 _PlasmaCartridgeC.Value = Player_PlasmaCartridgeC:GetAsync(Player.userId) or 250 _ShotgunShellC.Value = Player_ShotgunShellC:GetAsync(Player.userId) or 120 game.Players.PlayerRemoving:connect(function(Player) PlayerCaps:SetAsync(Player.userId, Caps.Value) PlayerScrap:SetAsync(Player.userId, Scrap.Value) Player_308cal:SetAsync(Player.userId, _308calC.Value) Player_38calC:SetAsync(Player.userId, _38calC.Value) Player_44calC:SetAsync(Player.userId, _44calC.Value) Player_45calC:SetAsync(Player.userId, _45calC.Value) Player_50calC:SetAsync(Player.userId, _50calC.Value) Player_5mmC:SetAsync(Player.userId, _5mmC.Value) Player_10mmC:SetAsync(Player.userId, _10mmC.Value) Player_2mmECC:SetAsync(Player.userId, _2mmECC.Value) Player_556mmC:SetAsync(Player.userId, _556mmC.Value) Player_9mmC:SetAsync(Player.userId, _9mmC.Value) Player_FusionCellC:SetAsync(Player.userId, _FusionCellC.Value) Player_PlasmaCartridgeC:SetAsync(Player.userId, _PlasmaCartridgeC.Value) Player_ShotgunShellC:SetAsync(Player.userId, _ShotgunShellC.Value) end) while true do wait(60) print ("AutoSave") PlayerCaps:SetAsync(Player.userId, Caps.Value) PlayerScrap:SetAsync(Player.userId, Scrap.Value) Player_308cal:SetAsync(Player.userId, _308calC.Value) Player_38calC:SetAsync(Player.userId, _38calC.Value) Player_44calC:SetAsync(Player.userId, _44calC.Value) Player_45calC:SetAsync(Player.userId, _45calC.Value) Player_50calC:SetAsync(Player.userId, _50calC.Value) Player_5mmC:SetAsync(Player.userId, _5mmC.Value) Player_10mmC:SetAsync(Player.userId, _10mmC.Value) Player_2mmECC:SetAsync(Player.userId, _2mmECC.Value) Player_556mmC:SetAsync(Player.userId, _556mmC.Value) Player_9mmC:SetAsync(Player.userId, _9mmC.Value) Player_FusionCellC:SetAsync(Player.userId, _FusionCellC.Value) Player_PlasmaCartridgeC:SetAsync(Player.userId, _PlasmaCartridgeC.Value) Player_ShotgunShellC:SetAsync(Player.userId, _ShotgunShellC.Value) end end) end) --game:GetService('Players').PlayerAdded:Connect(function(Player) --Player.CharacterAdded:Connect(function(Character) --Character:WaitForChild("Humanoid").Died:Connect(function() --local Cash = Player:WaitForChild("Cash") --local Caps = Player.Cash:WaitForChild("Caps") --PlayerCaps:SetAsync(Player.userId, Caps.Value) --print (Player.Name .. "Has Died Caps Modified") --end) --end) --end)
Updated to try something, did not work
local DSS = game:GetService("DataStoreService") local PlayerData = DSS:GetDataStore("PlayerData") game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) wait(1) if Player:FindFirstChild("Cash") == nil then local Cloned = script.Cash:Clone() Cloned.Parent = Player end if Player:FindFirstChild("AmmoBag") == nil then local Cloned = script.AmmoBag:Clone() Cloned.Parent = Player end local SaveData = {} SaveData.Caps = Player.Cash:WaitForChild("Caps").Value SaveData.Scrap = Player.Cash:WaitForChild("Scrap").Value SaveData._308cal = Player.AmmoBag.CurrentStoredAmmo:WaitForChild(".308cal").Value SaveData._38cal = Player.AmmoBag.CurrentStoredAmmo:WaitForChild(".38cal").Value SaveData._44cal = Player.AmmoBag.CurrentStoredAmmo:WaitForChild(".44cal").Value SaveData._45cal = Player.AmmoBag.CurrentStoredAmmo:WaitForChild(".45cal").Value SaveData._50cal = Player.AmmoBag.CurrentStoredAmmo:WaitForChild(".50cal").Value SaveData._10mm = Player.AmmoBag.CurrentStoredAmmo:WaitForChild("10mm").Value SaveData._2mmEC = Player.AmmoBag.CurrentStoredAmmo:WaitForChild("2mmEC").Value SaveData._556mm = Player.AmmoBag.CurrentStoredAmmo:WaitForChild("5.56mm").Value SaveData._5mm = Player.AmmoBag.CurrentStoredAmmo:WaitForChild("5mm").Value SaveData._9mm = Player.AmmoBag.CurrentStoredAmmo:WaitForChild("9mm").Value SaveData._FusionCell = Player.AmmoBag.CurrentStoredAmmo:WaitForChild("FusionCell").Value SaveData._PlasmaCartridge = Player.AmmoBag.CurrentStoredAmmo:WaitForChild("PlasmaCartridge").Value SaveData._ShotgunShell = Player.AmmoBag.CurrentStoredAmmo:WaitForChild("ShotgunShell").Value wait(1) for key, value in pairs(SaveData) do print("key", key, "value", value) end SaveData = PlayerData:GetAsync(Player.userId) game.Players.PlayerRemoving:connect(function(Player) PlayerData:SetAsync(Player.userId, SaveData) end) while true do wait(5) print ("AutoSave") PlayerData:SetAsync(Player.userId, SaveData) end end) end) --game:GetService('Players').PlayerAdded:Connect(function(Player) --Player.CharacterAdded:Connect(function(Character) --Character:WaitForChild("Humanoid").Died:Connect(function() --local Cash = Player:WaitForChild("Cash") --local Caps = Player.Cash:WaitForChild("Caps") --PlayerCaps:SetAsync(Player.userId, Caps.Value) --print (Player.Name .. "Has Died Caps Modified") --end) --end) --end)