How would I find the second table of a datastore data?

Hello!

This is just a quick question, so how would I be able to reach the second table of one Data in a datastore? There are 2 tables. The first table is the part where it says “Tall wall”, the second is where it says “Color”. What I’m trying achieve is a data saving/loading models with the BrickColorValue, I couldn’t figure out how to merge this into one table, so I wanna do it this way. Any suggestions?

I’ve tried table.find, but it won’t detect the second table…

Here’s a picture of my datastore data


Anything helps!

First, DataStore Editor got an update to V.3 so you should update it.
Second, what code do you have right now dealing with loading the data?

My code is a module, loading the data.

function Placement.fromSerialization(canvasPart, data)
	local self = Placement.new(canvasPart)
	local canvasCF = canvasPart.CFrame
	data = data or {}
	print(unpack(data))
	for cf, name in pairs(data) do
		local model = furniture:FindFirstChild(name)
		
		if (model) then
			local components = {}
				local components2 = {}
			for num in string.gmatch(cf, "[^%s,]+") do
				components[#components+1] = tonumber(num)
			end
			self:Place(model, canvasCF * CFrame.new(unpack(components)), false)
			print(model.Parent)
			print(unpack(components))
			print"loaded data"
			
			
		end
		
	end
	
	return self
end

I’m just so lost here, I can’t seem to load the second table.

Are you passing the data from DataStore:GetAsync() directly into the module as data? If so, I think data[2] would be your color. Can you do print(name) right before local model = ?

PrintingColor
PrintingTall Wall

Surprisingly, I could find “Color!” But I have no idea how to set the color to the “Really red” though…
String.match perhaps?

Okay so, I’ve been able to figure out the colors, however whenever I try to unpack the components and print it, it says
“M e d i u m s t o n e g r e y”
Instead of “Medium Stone Grey”
How would I prevent it from spacing?

if name=="Color" then
			local components = {}
				for num in string.gmatch(cf, ".") do
				components[#components+1] = tostring(num)
			end
			print(unpack(components))
			model.BrickColorVal.Value=BrickColor.new(unpack(components))
		end

First, where are you putting the if statement into your code and second, why would you need to use your components code?

So I could find the specific brickcolor, so it doesn’t get mistaken by the name “Color”, correct me if I’m wrong.

Right but where are you putting it inside your code.

If you mean the full code here,

function Placement.fromSerialization(canvasPart, data)
	local self = Placement.new(canvasPart)
	local canvasCF = canvasPart.CFrame
	data = data or {}
	print(unpack(data))
	for cf, name in pairs(data) do
		print("Printing"..name)
		local model = furniture:FindFirstChild(name)
		
		if (model) then
			local components = {}
				local components2 = {}
			for num in string.gmatch(cf, "[^%s,]+") do
				components[#components+1] = tonumber(num)
			end
			self:Place(model, canvasCF * CFrame.new(unpack(components)), false)
			print(model.Parent)
			print(unpack(components))
			print"loaded dat"
			
			
		end
		if name=="Color" then
			local components = {}
				for num in string.gmatch(cf, ".") do
				components[#components+1] = tostring(num)
			end
			print(unpack(components))
			model.BrickColorVal.Value=BrickColor.new(unpack(components))
		end
		
	end
	
	return self
end