Table showing as "instance" when I use "in Pairs"?

This error is showing that the DataStore is showing as an instance… even though when I try type() on the variable, it shows as an instance

image

local tags = {}

local dss = game:GetService("DataStoreService")
local DataStores = {
	dss:GetDataStore("GlobalData.GlobalLeaderBoard.GEMS"):GetAsync("index"),
}

print(type(DataStores[1]))

for _,tab in pairs(DataStores) do
	for _,v in pairs(tab) do -- error is here --
		if tags[tab[1]] then
			if tags[tab[1]][1]==6 then
				table.insert(tags[tab[1]],5)
			end
		else
			tags[tab[1]] = {6}
		end
	end
end
1 Like

GetAsync returns both the value and a DataStoreKeyInfo. Since you’re constructing the table directly from the return values, both values go into the table and key 2 gets assigned to the DataStoreKeyInfo instance.

1 Like

I just dumped the table and that was the error, thanks!