Datastores saving issue

So i’ve recently been having issues with my datastore script which is throwing the error 104: Cannot store Dictionary in data store. Data stores can only accept valid UTF-8 characters. I have no idea of what this means or what could be triggering it and i’ve ran out of ideas to fix it. May anyone help me?
Code:

Players.PlayerRemoving:Connect(function(player)
	local success, errormessage = pcall(function()
		local allData = {}
		allData["Level"] = player.Level.Level.Value
		allData["Exp"] = player.Level.Exp.Value
		allData["ExpNeeded"] = player.Level.NeededExp.Value
		allData["PostHalloween"] = player.Level.PostHalloween.Value
		allData["VIP"] = player.Level.VIPClaimed.Value
		allData["CurrentGadget"] = player.Gadget
		allData["OwnedGadgets"] = {}
		
		for _, ownedGadgets in ipairs(player.OwnedGadgets:GetChildren()) do
			table.insert(allData["OwnedGadgets"], ownedGadgets.Name.."_"..tostring(ownedGadgets.Value))
		end
		
		LevelsStore:SetAsync(player.UserId.."LevelData", allData) 
		OrderedStore:SetAsync(player.UserId, allData["Level"])
	end)
	
	if success then	
		print("Levels data was saved!")
	else	
		warn(errormessage)	
	end
	
end)

Also, this problem didn’t appear until i added the OwnedGadgets table, so it’s gotta be something relating to it. What could be causing this?

it might be because player.Gadget is an instance rather than a value like string

Yeah, this ended up fixing it, thanks for the help lmao

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.