Can someone tell me why this isn't working? All it's doing is storing values from a table, the non table ones work but for some reason this doesn't save with no errors
game.Players.PlayerAdded:Connect(function(player)
local playerMana = DataStore2("Mana", player)
local playerSouls = DataStore2("Souls", player)
local playerRebirths = DataStore2("Rebirths", player)
local playerAttacks = DataStore2("Attacks", player)
local attacks = {
["Smash"] = true,
["Fireball"] = false,
["Blast"] = false
}
local statsFolder = Instance.new("Folder", player)
statsFolder.Name = "Data"
local attacksFolder = Instance.new("Folder", player)
attacksFolder.Name = "Attacks"
local mana = Instance.new("NumberValue", statsFolder)
local souls = Instance.new("NumberValue", statsFolder)
local rebirths = Instance.new("NumberValue", statsFolder)
--Attack values
local smash = Instance.new("BoolValue", attacksFolder)
local fireball = Instance.new("BoolValue", attacksFolder)
local blast = Instance.new("BoolValue", attacksFolder)
mana.Name = "Mana"
souls.Name = "Souls"
rebirths.Name = "Rebirths"
--Attack names
smash.Name = "Smash"
fireball.Name = "Fireball"
blast.Name = "Blast"
local getMana = playerMana:Get()
local getSouls = playerSouls:Get()
local getRebirths = playerRebirths:Get()
local getAttacks = playerAttacks:Get()
--Load
if getMana ~= nil then
mana.Value = getMana
else
mana.Value = 0
end
if getSouls ~= nil then
souls.Value = getSouls
else
souls.Value = 0
end
if getRebirths ~= nil then
rebirths.Value = getRebirths
else
rebirths.Value = 0
end
if getAttacks ~= nil then
for i, v in pairs(player.Attacks:GetChildren()) do
v.Value = getAttacks[v.Name]
end
else
for i, v in pairs(player.Attacks:GetChildren()) do
v.Value = attacks[v.Name]
end
end
--Save
mana.Changed:Connect(function()
playerMana:Set(mana.Value)
end)
souls.Changed:Connect(function()
playerSouls:Set(mana.Value)
end)
rebirths.Changed:Connect(function()
playerRebirths:Set(mana.Value)
end)
smash.Changed:Connect(function()
playerAttacks:Set("Smash", smash.Value)
end)
fireball.Changed:Connect(function()
playerAttacks:Set("Fireball", fireball.Value)
end)
blast.Changed:Connect(function()
playerAttacks:Set("Blast", blast.Value)
end)
end)
The other values save, the dictionary does not.
