Hello, i made a bool value saving system but it somehow does not works. Everything works well but it does not save the data when player leaves. With prints it prints "Trying to save data" but then nothing and nothing works.
local service = game:GetService("DataStoreService") local dataStore = service:GetOrderedDataStore("BoolValueDataStore") game.Players.PlayerAdded:Connect(function(player) local stats = Instance.new("IntValue",player) stats.Name = "BoolValues" local doorOpen = Instance.new("BoolValue", stats) doorOpen.Name = "DoorOpen" doorOpen.Value = false local data local success = pcall(function() data = dataStore:GetAsync(player.UserId,doorOpen.Value) end) if success then doorOpen.Value = data print("data restored") end end) game.Players.PlayerRemoving:Connect(function(player) pcall(function() print("trying to save data") dataStore:SetAsync(player.UserId, player.BoolValues.DoorOpen.Value) print("data saved") end) end)