Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Fix? - Cannot store Instance in data store. Data stores can only accept valid UTF-8 characters.

Script

for i,v in pairs(game.Workspace.Teleports:GetChildren()) do
	local dss = game:GetService("DataStoreService")
	local sv = dss:GetDataStore("Save1")
	
		game.Players.PlayerAdded:Connect(function(plr)
			local SetSuccess, errormessage = pcall(function()
			local PortalData = sv:SetAsync(plr.UserId,v)
		end)
		if not SetSuccess then
			warn(errormessage)
			
			local GetSuccess, amount = pcall(function()
				return sv:GetAsync(plr.UserId)
			end)
			if GetSuccess then
				print(amount)
			end
		end
	end)
end

1 answer

You should first know what you can save inside a data store, you cannot save an instance inside of it. Instead I'd recommend saving it's name(string), and getting the instance from a table or use your own ways. Also, I'd recommend don't making many data stores, just make one, and save each value with a different key using only one data store.

This discussion is preserved as it was. New answers, comments, and votes are closed.