i stole this script from another forum, apparently datastores can’t be given tables, what other way is there where can i save/load the contents of a folder?
( the folder has StringValues in it )
local dataservice = game:GetService("DataStoreService")
local inventorydata = dataservice:GetDataStore("Inventory")
local itemsfolder = game.ServerStorage.Skins
game.Players.PlayerAdded:Connect(function(player)
local inventory = inventorydata:GetAsync(player.UserId) or {}
for i, si in pairs(inventory) do
if itemsfolder:FindFirstChild(si) then
itemsfolder.si:Clone().Parent = player.Inventory
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local inventory = {}
for i, si in pairs(player.Inventory:GetChildren()) do
table.insert(inventory,si)
end
local success, errormsg = pcall(function()
inventorydata:SetAsync(player.UserId, inventory)
end)
if errormsg then
warn(errormsg)
end
end)
( gives me the error “104: Cannot store Array in data store. Data stores can only accept valid UTF-8 characters.” )