DataStore: 104: Cannot store Array in data store. Data stores can only accept valid UTF-8 characters

hey, im trying to make a datastore system for my storage. but there is a little problem. i keep getting this error
“104: Cannot store Array in data store. Data stores can only accept valid UTF-8 characters.”
im not rlly good at datastores, so i have no clue what it means. i tried fixing it but… didnt work.
(this script isnt mine, i just modified it)

game.Players.PlayerAdded:Connect(function(player)
	local storage = player:WaitForChild("Storage")
	local load = ds:GetAsync("User_"..player.UserId) or {}
	if type(load) == "table" then
		for i, v in pairs(load) do
			for name, value in pairs(v) do
				
				local object = Instance.new("ObjectValue")
				object.Parent = storage
				object.Name = name
				object.Value = value
				
			end
		end
	else
		load = {}
	end
end)

game.Players.PlayerRemoving:Connect(function(player)
	local data  = {}
	local storage = player:WaitForChild("Storage")
	for i, v in pairs(storage:GetChildren()) do
		if v:IsA("ObjectValue") then
			local nameAndVal = {}
			nameAndVal[v.Name] = v.Value
			table.insert(data, nameAndVal)
		end
	end
	local res = ds:SetAsync("User_"..player.UserId, data)
end)

game:BindToClose(function()
	for i, player in pairs(game.Players:GetPlayers()) do
		local data  = {}
		local storage = player:WaitForChild("Storage")
		for i, v in pairs(storage:GetChildren()) do 
			if v:IsA("ObjectValue") then
				local nameAndVal = {} 
				nameAndVal[v.Name] = v.Value
				table.insert(data, nameAndVal)
			end
		end
		local res = ds:SetAsync("User_"..player.UserId, data)
	end
end)

if you have any ideas why it doesnt work please comment below.

1 Like

It means that it can only use standard keys and symbols when storing data.

Using non-standard characters may not work with the datastore’s compatibility

https://www.fileformat.info/info/charset/UTF-8/list.htm

soooo, its trying to set the table. so it cant save tables?

You’re trying to save instances through ObjectValues. You can’t save instances in DataStores.

i guess that makes sence, ill try fixing it

so here, im trying to save just the items name. but it sitll gives me a error.
(DataStoreService: CantStoreValue: Cannot store Instance in data store. Data stores can only accept valid UTF-8 characters. API: SetAsync, Data Store: DataStoreTest - Studio

game.Players.PlayerAdded:Connect(function(player)
	local storage = player:WaitForChild("Storage")
	local load = ds:GetAsync("UserAuras-"..player.UserId) or {}
	if type(load) == "table" then
		for i, v in pairs(load) do
			for name, value in pairs(v) do
				
				local object = Instance.new("ObjectValue")
				object.Parent = storage
				object.Name = value
				local aura
				for _,v in pairs(game.ReplicatedStorage.Auras:GetChildren()) do
					if v.Name == value then
						aura = v
					end
				end
				object.Value = aura	
				
			end
		end
	else
		load = {}
	end
end)

game.Players.PlayerRemoving:Connect(function(player)
	local data  = {}
	local storage = player:WaitForChild("Storage")
	for i, v in pairs(storage:GetChildren()) do
		if v:IsA("ObjectValue") then
			local val = v.Value.Name
			table.insert(data, val)
		end
	end
	local res = ds:SetAsync("UserAuras-"..player.UserId, data)
end)

game:BindToClose(function()
	for i, player in pairs(game.Players:GetPlayers()) do
		local data  = {}
		local storage = player:WaitForChild("Storage")
		for i, v in pairs(storage:GetChildren()) do 
			if v:IsA("ObjectValue") then
				local val = v.Value.Name
				table.insert(data, val)
			end
		end
		local res = ds:SetAsync("UserAuras-"..player.UserId, data)
	end
end)