How to get arguments from using string.split on a table?

I want to get arguments from using string.split on a table.
I got the string.split working but i don’t know how to format it into the arguments

The arguments I want are blockName and blockCframe.

local tabel = {
	[1] = '"totemIron"|||"-3503, 48, -3683, 1, 0, 0, 0, 1, 0, 0, 0, 1"',
	[2] = '"totemIron"|||"-3503, 48, -3692, 1, 0, 0, 0, 1, 0, 0, 0, 1"',
	[3] = '"totemIron"|||"-3500, 48, -3698, 0, 0, 1, 0, 1, -0, -1, 0, 0"',
	[4] = '"totemIron"|||"-3503, 48, -3671, 1, 0, 0, 0, 1, 0, 0, 0, 1"',
	[5] = '"totemIron"|||"-3503, 48, -3686, 1, 0, 0, 0, 1, 0, 0, 0, 1"',
	[6] = '"totemIron"|||"-3485, 48, -3692, 1, 0, 0, 0, 1, 0, 0, 0, 1"',
	[8] = '"pinePlank"|||"-3494, 54, -3659, 1, 0, 0, 0, 1, 0, 0, 0, 1"'
}


for index = 1, #tabel do
    local split = string.split(tabel[index], "|||")
    
    for index, value in pairs(split) do
        local args = {
            [1] = {
                ["cframe"] = blockCframe, -- I need help getting this
                ["blockType"] = blockName -- I need help getting this
            }
        }

        game:GetService("ReplicatedStorage").PlaceBlock:InvokeServer(unpack(args))
    end
end
1 Like

Why don’t you put the CFrame and the BlockType in a table like this

local tabel = {
	{"totemIron",CFrame.new(-3503, 48, -3683, 1, 0, 0, 0, 1, 0, 0, 0, 1)},
    -- The rest
}

I got the table formatted to this now:

local tabel = {
	{"totemIron",CFrame.new(-3503, 48, -3683, 1, 0, 0, 0, 1, 0, 0, 0, 1)},
	{"totemIron",CFrame.new(-3503, 48, -3692, 1, 0, 0, 0, 1, 0, 0, 0, 1)},
	{"totemIron",CFrame.new(-3500, 48, -3698, 0, 0, 1, 0, 1, -0, -1, 0, 0)},
	{"totemIron",CFrame.new(-3503, 48, -3671, 1, 0, 0, 0, 1, 0, 0, 0, 1)},
	{"totemIron",CFrame.new(-3503, 48, -3686, 1, 0, 0, 0, 1, 0, 0, 0, 1)},
	{"pinePlank",CFrame.new(-3494, 54, -3659, 1, 0, 0, 0, 1, 0, 0, 0, 1)}
}

How do I separate the blockName (string) from the blockCFrame (CFrame)?

for index = 1, #tabel do
	local val = tabel[index]
	local args = {
		[1] = {
			["cframe"] = val[2], -- I need help getting this
			["blockType"] = val[1] -- I need help getting this
		}
	}

	game:GetService("ReplicatedStorage").PlaceBlock:InvokeServer(unpack(args))
end
1 Like
for _,v in tabel do
	local args = {
		v[1], -- BlockType
		v[2] -- Cframe
	}
end

I don’t understand how the place block function works can you show me the script handling it?