how can i get it to save a dictionary or what alternatives could i try
if success then
print("connected player to database")
if true then --not playerData then
print("Assigning default data")
playerData = {
["Cash"] = 10,
["TotalDisasters"] = 0,
["SurvivedDisasters"] = 0,
["TotalMaps"] = 0,
["TotalDeaths"] = 0,
["TotalCash"] = 10,
["TotalJoins"] = 0,
["JoinDate"] = os.date(),
["JoinEpoch"] = os.time(),
["Banned"] = false,
["BannedReason"] = "No Reason Given",
["BannedUntil"] = 0,
["BannedUntilYear"] = 0,
["BannedUntilMonth"] = 0,
["BannedUntilDay"] = 0,
["TotalBans"] = 0,
["LastDate"] = os.date(),
["LastEpoch"] = os.time(),
["CurrentTitle"] = 0,
["Inventory"] = {
{
Type = "Title",
Name = "Alpha Tester",
Rarity = "Legendary",
Text = "Alpha Tester",
Col = Color3.new(0.133333, 0.392157, 1)
},
{
Type = "Item",
Name = "Classic Sword",
Rarity = "Common",
Tool = ReplicatedStorage.Assets.Tools.ClassicSword,
}
}
}
end
sessionData[newPlayer.UserId] = playerData
20:40:53.368 DataStoreService: CantStoreValue: Cannot store Dictionary in data store. Data stores can only accept valid UTF-8 characters. API: SetAsync, Data Store: data - Studio
20:40:53.383 104: Cannot store Dictionary in data store. Data stores can only accept valid UTF-8 characters. - Server
function PlayerLeaving(player)
if sessionData[player.UserId] then
local success = nil
local errorMsg = nil
local attempt = 1
repeat
success, errorMsg = pcall(function()
database:SetAsync(player.UserId, sessionData[player.UserId])
end)
attempt += 1
if not success then
warn(errorMsg)
task.wait(3)
end
until success or attempt == 5
if success then
print("Data saved for ", player.Name)
else
warn("Data unable to be saved for ", player.Name)
end
end
end
game.Players.PlayerRemoving:Connect(PlayerLeaving)