I’m am trying to save a lot of folders that have different weapons and their data but every time I saving the data it gives the error
“Cannot store Dictionary in data store. Data stores can only accept valid UTF-8 characters”
I don’t understand why. I did try making the folders into tables that hold the values and it still doesn’t work.
Here is the code
local function folderToDictionary(folder)
local dictionary = {}
for _, object in ipairs(folder:GetChildren()) do
if object:IsA("Folder") then
dictionary[object.Name] = folderToDictionary(object)
elseif object:IsA("ValueBase") or object.ClassName:match("Value") then
dictionary[object.Name] = object.Value
end
end
return dictionary
end
game.Players.PlayerRemoving:Connect(function(plr)
local plrData = folderToDictionary(plr.Weapons)
print(plrData)
local Success,err = pcall(function()
DataStore:SetAsync(plr.UserId,data)
end)
end)
Any help would be very useful and thank you