Attempt to perform arithmetic (add) on nil and Vector3

Hello, i have the error “attempt to perform arithmetic (add) on nil and Vector3”, I need help please,
my script :

local blockClone = block:Clone()

	blockClone.Parent = clonedTemplate.BlockImage
	
	local blockChilds = blockClone:GetChildren()
	
	local cam = Instance.new("Camera")
	clonedTemplate.BlockImage.CurrentCamera = cam
	cam.Parent = clonedTemplate.BlockImage

	cam.CFrame = CFrame.new(blockChilds.Position + Vector3.new(3.3, 3.3, 3.3), blockChilds.Position)

Thanks to anyone can help me!

Try adding:

print(blockChilds)

to see what it is.

It looks like it will be a table of parts; so, you are trying to apply position to a table.

1 Like

I receive the following data: {[1] = Dirt}
However, they are good children

I tried to do print(blockChilds.Position) and I received nil

:GetChildren() Returns a table of instances, You are trying to get the position of a Table.

Try print(blockChilds[1].Position) and see if it works.

1 Like

Thanks, it worked, however how can I get the position of several objects without having to list them all (do [1] for all childrens?)

This is the only way i know of by what you are describing

for tablepos,instance in pairs(blockChilds) do
print(instance.Position)
end
1 Like

Thanks, I hadn’t thought of that, that solved my problem!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.