Invalid argument #1 to 'pairs' (table expected, got nil)

Hi! So I’ve been trying to make a part save system, and it has not being going well.
I get the error:
error generating data: ServerScriptService.Serializer:57: invalid argument #1 to ‘pairs’ (table expected, got nil) for slot Slot1 for plr GalacticLemon_Aj
I really don’t know why this is happening.
The code:

local function save(plr,slot)
	print('save')

	local data
	local s,x = pcall(function()
		print('pcall')
		print(workspace:WaitForChild('Blocks'):WaitForChild(plr.Name))
		local stuff = {}
		local thing = workspace.Blocks:FindFirstChild(plr.Name)
		if thing then
			local thingTable = thing:GetChildren()
			if thingTable then
				for _, t in pairs(workspace:WaitForChild('Blocks'):WaitForChild(plr.Name):GetChildren()) do
					print(t.Name)
					table.insert(stuff,t)
				end
			end
		end
		--local stuff = workspace.Blocks[plr.Name]:GetChildren()
		data = Save.Encrypt(stuff)
	end)

	local su,xa = pcall(function()
		local key = tostring(plr.UserId..'&'..(slot))
		DS:SetAsync(key,data)
	end)

	if s then
		print('successfully generated data.')
	elseif x then
		warn('error generating data: '..x..' for slot '..slot..' for plr '..plr.Name)
	end
	if su then
		print('successfully saved data')
	elseif xa then
		warn('error saving data: '..xa..' for slot '..slot..' for plr '..plr.Name)
	end
end

You my be wanting the code behind the Save.Encrypt() function, so here it is!

Code

Save.Encrypt()

function module.Encrypt(objs)
	return HttpService:JSONEncode(InitProps(objs))
end

InitProps()

function InitProps(objects)
	local tableToSave = {}
	for _, obj in pairs(objects) do
		local class = obj.ClassName
		local t = tableToSave[class]
		if not(t) then
			tableToSave[class] = {}
			t = tableToSave[class]
		end
		local add = {}
		for _, Prop in pairs(Properties[obj.ClassName]) do -- this is the line that errors
			add[Prop] = Serialize(obj[Prop])
		end
		local children = obj:GetChildren()
		if #children > 0 then
			add["Children"] = InitProps(children)
		end
		table.insert(t, add)
	end
	return tableToSave
end

Finally, Serialize()

function Serialize(prop)
	local typ = typeof(prop)
	local r 
	if typ == "BrickColor" then
		r = tostring(prop)
	elseif typ == "CFrame" then
		r = {pos = Serialize(prop.Position), rX = Serialize(prop.rightVector), rY = Serialize(prop.upVector), rZ = Serialize(-prop.lookVector)}
	elseif typ == "Vector3" then
		r = {X = prop.X, Y = prop.Y, Z = prop.Z}
	elseif typ == "Color3" then
		r = {Color3.toHSV(prop)}
	elseif typ == "EnumItem" then
		r = {string.split(tostring(prop), ".")[2], string.split(tostring(prop), ".")[3]}
	else
		r = prop
	end
	return r
end

I did have to restart this post because it seems my other one died.

Difficult to tell unless you annotate which line the error is occurring at.

Is it this section:

You can probably remove the WaitForChild statements in there. A save function should be running well after the full workspace has loaded. As it stands, the error you get is telling you that the table is empty. You also seem to be repeating yourself and making the mistake of not actually using values you assign to variables:

		local thing = workspace.Blocks:FindFirstChild(plr.Name)		
		if thing then
			local thingTable = thing:GetChildren()
			print(thingTable) -- does this print anything? Is it what you expect?
			if thingTable then
				for _, t in pairs(thingTable) do -- You have already got the 
					print(t.Name)
					table.insert(stuff,t)
				end
			end
		end

No. Did you not look into the code behind Save.Encrypt? The error is in there.