# Help with XYZ Direction Blocks

Is there any better way to make this?

``````local Origin =script.Parent

local XYZ = {
 = Vector3.new(1,0,0), -- X
 = Vector3.new(0,1,0), -- Y
 = Vector3.new(0,0,1), -- Z

 = Vector3.new(-1,0,0), -- -X
 = Vector3.new(0,-1,0), -- -Y
 = Vector3.new(0,0,-1), -- -Z
}

for i = 1,6 do
local XYZPart = Instance.new("Part")
XYZPart.Position = Origin.Position + XYZ[i] * 12
XYZPart.Anchored = true
XYZPart.Parent = workspace
XYZPart.Size = Vector3.new(12,12,12)
XYZPart.CanCollide =false
end
``````

I want the Blocks to be positioned in X Y Z Direction I’m curious if there is any better way to do this

This post should be transferred over to #help-and-feedback:code-review

You can use Vector3.FromAxis and some extra math

``````for i = 0, 5, 1 do
local XYZPart = Instance.new("Part")
XYZPart.Anchored = true
XYZPart.Parent = workspace
XYZPart.Size = Vector3.new(12,12,12)
XYZPart.CanCollide = false
XYZPart.Position = Origin.Position + Vector3.FromAxis(math.floor(i/2))*((i%2-0.5)*24),
end
``````