I have a lot of data that is similar but has one part different so I tried making for loop to go through and add to the playerData.
local playerData = {}
for i, tower in pairs(tycoon.BallTowers:GetChildren()) do
PlayerData[tower.Name] = {
Damage = tower.Damage.Value,
Speed = tower.Speed.Value,
Quantity = tower.Quantity.Value,
}
end
However, it’s not saving and I have no idea why. Printing before saving it shows me all the values I added. But printing after saving all the values are gone. I’m extremely stumped right now.
You’re setting playerData again as the value to save which has been defined as an Empty Table. So, it’s only going to save an empty table every time. This is why your values are Nil when you print them after setting your data.
remove the playerData value from the SetAsync property and see if this changes anything