The two types that put anything anywhere in the world — position with Vector3, and position plus rotation with CFrame.
Every object in Roblox lives at a point in 3D space. Two types describe that point: (where something is) and (where it is and which way it faces). Master these two and you can place anything, anywhere, facing any direction.
A is three numbers: X, Y, and Z. X goes left-right, Y goes up-down, Z goes forward-back.
local point = Vector3.new(10, 5, -3)
print(point.X) -- 10
print(point.Y) -- 5
print(point.Z) -- -3
You already know this — a 's Position is a :
print(part.Position) -- Vector3(10, 5, -3)
print(part.Position.X) -- 10
How do you create a Vector3 at X=3, Y=7, Z=0? Vector3.new() → fill in the three numbers
Change a 's position by assigning a new to its Position:
part.Position = Vector3.new(0, 10, 0) -- move to the sky
also does math — add, subtract, multiply:
local start = part.Position
local offset = Vector3.new(0, 5, 0)
part.Position = start + offset -- move 5 studs up
Subtracting two positions gives the direction and distance between them — that's how and cameras figure out where to look.
local diff = target.Position - part.Position
print(diff.Magnitude) -- how far apart (a number)
What does (A.Position - B.Position).Magnitude return?
A is a position + orientation in one value. It tells Roblox both where an object is and which way it faces.
local cf = CFrame.new(10, 5, 0)
print(cf.Position) -- Vector3(10, 5, 0)
A plain CFrame.new(x, y, z) puts something at that point with no rotation — same as setting Position. The power comes from adding a rotation target:
-- Face the part toward a point
part.CFrame = CFrame.new(part.Position, target.Position)
The second argument is the lookAt point. The 's front face points toward it.
You can also rotate by angle: CFrame.Angles(0, math.rad(90), 0) rotates 90 degrees around the Y (up) axis. Angles are in radians — use math.rad() to convert degrees.
The real win: lets you place and orient something in one assignment. This is how moving platforms, camera rigs, and tool welds work:
-- Put a part at (0, 10, 0) facing toward the origin
part.CFrame = CFrame.new(0, 10, 0, CFrame.new(0, 10, 0).LookVector)
Or simpler — use CFrame.lookAt:
part.CFrame = CFrame.lookAt(
Vector3.new(0, 10, 0), -- where
Vector3.new(0, 0, 0) -- what to face
)
Move part to position (5, 20, 5) and make it face toward (5, 0, 5) — straight down. Write one CFrame.lookAt assignment.
local part = workspace.Part\n-- your CFrame.lookAt line hereCFrame.new(part.Position) and CFrame.new(10, 5, 0) both work.CFrame.new(pos, lookAt) — first is where, second is what to face.Next: let's put it to work — meeting the in your game.