so i have tried both DataStore and DataStore2 to save a list of boolvalues for me and its not saving when it changes but in the server log it says that it does, but it doesnt i do have a DataStore that saves another set of boolvalues and it works just fine even being a regular DataStore
here is the script i got to save them
local DS2 = require(1936396537)
game.Players.PlayerAdded:Connect(function(plr)
local speedData = DS2('Speed', plr)--Get the speed datastore
local healthData = DS2('Health', plr)--Get the health datastore
--Speed
local Speed = Instance.new("Folder")
Speed.Name = "Speed"
Speed.Parent = plr
local Five = Instance.new("BoolValue")
Five.Name = "Five"
Five.Parent = Speed
local Ten = Instance.new("BoolValue")
Ten.Name = "Ten"
Ten.Parent = Speed
local Fifteen = Instance.new("BoolValue")
Fifteen.Name = "Fifteen"
Fifteen.Parent = Speed
local Twenty = Instance.new("BoolValue")
Twenty.Name = "Twenty"
Twenty.Parent = Speed
for i,v in pairs (Speed:GetChildren()) do
v.Changed:connect(function()
local Saving = {
["Five"] = (plr.Speed).Five.Value;
["Ten"] = (plr.Speed).Ten.Value;
["Fifteen"] = (plr.Speed).Fifteen.Value;
["Twenty"] = (plr.Speed).Twenty.Value;
}
speedData:Set(Saving)
print('Saved '..plr.Name..'s Speed Data')
end)
end
print("Gave "..plr.Name.." Speed Data")
local SavedItems = speedData:Get(nil)
if SavedItems then
Five.Value = SavedItems.Five or false
Ten.Value = SavedItems.Ten or false
Fifteen.Value = SavedItems.Fifteen or false
Twenty.Value = SavedItems.Twenty or false
print(plr.Name.." had Speed data")
else
Five.Value = false
Ten.Value = false
Fifteen.Value = false
Twenty.Value = false
print(plr.Name.." didn't have Speed data")
end
--MaxHealth
local MaxHealth = Instance.new("Folder")
MaxHealth.Name = "MaxHealth"
MaxHealth.Parent = plr
local First = Instance.new("BoolValue")
First.Name = "First"
First.Parent = MaxHealth
local Second = Instance.new("BoolValue")
Second.Name = "Second"
Second.Parent = MaxHealth
local Third = Instance.new("BoolValue")
Third.Name = "Third"
Third.Parent = MaxHealth
local Fourth = Instance.new("BoolValue")
Fourth.Name = "Fourth"
Fourth.Parent = MaxHealth
local Fifth = Instance.new("BoolValue")
Fifth.Name = "Fifth"
Fifth.Parent = MaxHealth
for i,v in pairs (MaxHealth:GetChildren()) do
v.Changed:connect(function()
local Saving = {
["First"] = (plr.MaxHealth).First.Value;
["Second"] = (plr.MaxHealth).Second.Value;
["Third"] = (plr.MaxHealth).Third.Value;
["Fourth"] = (plr.MaxHealth).Fourth.Value;
["Fifth"] = (plr.MaxHealth).Fourth.Value;
}
healthData:Set(Saving)
print('Saved '..plr.Name's MaxHealth Data.')
end)
end
print("Gave "..plr.Name.." MaxHealth Data")
SavedItems = healthData:Get(nil)
if SavedItems then
First.Value = SavedItems.First or false
Second.Value = SavedItems.Second or false
Third.Value = SavedItems.Third or false
Fourth.Value = SavedItems.Fourth or false
Fifth.Value = SavedItems.Fifth or false
print(plr.Name.." had MaxHealth data")
else
First.Value = false
Second.Value = false
Third.Value = false
Fourth.Value = false
Fifth.Value = false
print(plr.Name.." didn't have MaxHealth data")
end
end)
when the values change the server does print Saved MaxHealth Data but when a player rejoins the value is back at false

1 comment
Your table will take time for the datastores to SetAsync