local DataStoreService = game:GetService("DataStoreService") local MyDataStore = DataStoreService:GetDataStore("HaveBreathing") game.Players.PlayerAdded:Connect(function(player) local havebre = Instance.new("Folder") havebre.Name = "havebre" havebre.Parent = player local HaveBreathing = Instance.new("IntValue") HaveBreathing.Name = "HaveBreathing" HaveBreathing.Parent = havebre end) game.Players.PlayerRemoving:Connect(function(player) MyDataStore:SetAsync(player.UserId, player.havebre.HaveBreathing.Value) end)
dont save why
It IS Saving it, you are just not assigning the value of the "IntValue".
HaveBreathing.Value = MyDataStore:GetAsync(player.UserId)
This should work also, you can put whatever you need inside the code
local sampleDataStore = game:GetService("DataStoreService"):GetDataStore("MyDataStore") game.Players.PlayerRemoving:Connect(function(player) local playerKey = "Player_" .. player.UserId local success, val = pcall(function() return sampleDataStore:RemoveAsync(playerKey) end) if success then print(val) end end)