How to make a part move forward in Roblox
The simplest way to move a part forward in Roblox is to change its Position property using a script. In Roblox Studio, select the part you want to move, then write a script that modifies the part's position over time. The most common approach uses either CFrame (which handles both position and rotation) or the Position property directly, combined with a loop that runs every frame.
Here's the basic pattern: create a script inside the part, then use a while loop with game:GetService("RunService").Heartbeat:Wait() to move the part a small distance each frame. For example, a script that moves a part forward 5 studs per second would add a small increment to the part's X, Y, or Z coordinate each time the loop runs. The direction depends on which axis you modify — Z typically moves forward or backward in Roblox's default orientation.
Key Takeaways
- CFrame is the standard tool for moving parts because it handles position and rotation together, while the Position property alone only changes location.
- A while loop with Heartbeat:Wait() lets you move a part smoothly by adding small increments each frame rather than jumping it to a new spot when ready.
- The direction a part moves depends on which axis you modify: X moves left and right, Y moves up and down, Z moves forward and backward.
- TweenService is the best choice if you want smooth, controlled motion with a specific duration and easing curve, rather than writing a manual loop.
Using CFrame for position and rotation together
CFrame is Roblox's coordinate frame object, and it's the preferred way to move parts because it stores both position and rotation in one value. When you set a part's CFrame, you control exactly where it is and which direction it faces. This matters because many moving parts in games need to rotate as they move — a rolling ball, a rotating door, or a spinning platform all use CFrame to handle both at once.
To move a part forward using CFrame, you modify the part's CFrame by adding a vector in the direction you want. The code pattern looks like this: part.CFrame = part.CFrame + part.CFrame.LookVector * distance. The LookVector points in the direction the part is already facing, so multiplying it by a distance moves the part forward relative to its current rotation. If the part rotates, the direction it moves rotates with it.
Alternatively, you can move a part along a fixed world axis by using part.CFrame = part.CFrame + Vector3.new(x, y, z). This adds the same offset every frame regardless of which way the part is facing. Choose this method when you want consistent motion in one direction, like a platform that always moves east.
Moving parts smoothly with a loop and Heartbeat
To make motion look smooth rather than jerky, use a loop that runs once per frame. Roblox runs at 60 frames per second by default, so a loop that waits for Heartbeat 60 times will take one second. Inside the loop, move the part a small amount each iteration.
A basic script looks like this: create a while true loop, move the part by a small amount (like 0.1 studs), then wait for the next heartbeat. If you want the part to move 5 studs per second, divide 5 by 60 to get roughly 0.083 studs per frame. The smaller the increment, the smoother the motion looks, but the part still moves at the same overall speed.
This approach works well for continuous motion like conveyor belts or rotating platforms. The downside is that the loop runs forever unless you add a condition to stop it. If you want the part to move only when something happens — a player touches it, a timer expires, or a value changes — add an if statement inside the loop to check that condition before moving.
Using TweenService for controlled, timed motion
TweenService is Roblox's built-in tool for animating properties over a set duration. Instead of writing a loop, you tell TweenService where you want the part to go and how long it should take, and the service handles the motion automatically. This is cleaner than a manual loop and gives you more control over how the motion feels.
To use TweenService, create a TweenInfo object that specifies the duration, easing style (like linear, ease-in, or bounce), and direction. Then create a Tween by passing the part, the TweenInfo, and a table of properties you want to change — usually CFrame or Position. Call :Play() on the tween to start it. The tween runs in the background while your script continues, so you can start multiple tweens at once or chain them together.
TweenService is ideal when you know exactly how long the motion should take and want it to feel polished. A part sliding into place over 0.5 seconds with an ease-out curve looks more professional than a part that moves at a constant speed. You can also use tweens to move parts along a path by chaining multiple tweens together, each moving the part to the next waypoint.
Choosing between fixed and relative motion
Fixed motion moves a part along the world's axes — always north, south, east, or west. Relative motion moves a part based on which way it's already facing. The choice depends on what you're building. A sliding door that always moves left and right uses fixed motion. A car that moves forward in whatever direction it's pointing uses relative motion.
For fixed motion, use part.CFrame = part.CFrame + Vector3.new(x, y, z) or modify the Position property directly. For relative motion, use part.CFrame = part.CFrame + part.CFrame.LookVector * distance or part.CFrame = part.CFrame * CFrame.new(0, 0, -distance). The second relative method multiplies the CFrame instead of adding to it, which keeps the part's rotation intact while moving it forward in its local space.
Handling collisions and physics while moving
When you move a part by changing its CFrame or Position directly, you bypass Roblox's physics engine. The part teleports to its new location each frame without colliding with other parts. This is fine for platforms, doors, and visual effects, but it causes problems if you want the part to interact with physics — rolling, sliding, or being pushed by other objects.
If you need physics interactions, use AssemblyLinearVelocity instead. This property sets how fast the part is moving, and the physics engine handles collisions and gravity. Set part.AssemblyLinearVelocity = Vector3.new(x, y, z) to make the part move at a constant velocity. The part will collide with other parts, fall if gravity is on, and respond to forces naturally. The downside is that you have less precise control — the part's exact position depends on what it collides with.
Common mistakes and how to avoid them
The most common mistake is moving a part inside a script that runs once instead of a loop. If you write a script that just says part.CFrame = part.CFrame + Vector3.new(5, 0, 0) with no loop, the part moves 5 studs once and then stops. Always wrap movement code in a while loop or use TweenService to make the motion continuous or timed.
Another mistake is forgetting that CFrame includes rotation. If you set part.CFrame = CFrame.new(x, y, z) without preserving the part's current rotation, the part snaps to face a default direction. Use part.CFrame = part.CFrame + offset instead to keep the rotation and only change position. Similarly, if you use Position to move a part but then try to rotate it with CFrame, the Position change gets overwritten — always use CFrame for both position and rotation together.
A third mistake is moving a part too fast for the frame rate. If you move a part 10 studs per frame at 60 FPS, it moves 600 studs per second, which is usually too fast to see clearly. Calculate the distance per frame by dividing your desired speed by 60. For a part that should move 10 studs per second, move it 10/60 ≈ 0.167 studs per frame.
Frequently Asked Questions
What's the difference between Position and CFrame?
Position only stores where a part is located. CFrame stores both position and rotation. If you only care about moving a part without rotating it, Position is simpler. If the part needs to face a certain direction or you want rotation and position to stay synchronized, use CFrame.
How do I make a part move in a circle?
Use a loop that calculates the part's position based on an angle that increases each frame. The formula is x = centerX + radius * math.cos(angle) and z = centerZ + radius * math.sin(angle). Increment the angle by a small amount each frame, and the part traces a circle. Adjust the increment to control how fast the circle completes.
Can I move a part and have it collide with other parts?
Not if you change CFrame or Position directly — those bypass physics. Use AssemblyLinearVelocity to set the part's speed, and the physics engine will handle collisions. The trade-off is less precise control over the exact position.
Why does my part move jerkily instead of smoothly?
The increment per frame is probably too large. If you're moving the part 1 stud per frame, it jumps visibly. Divide the total distance by 60 to get a smooth increment for one second of motion. You can also use TweenService, which handles smoothing automatically.
How do I stop a moving part?
If you're using a while loop, add a condition to break out of it — for example, if not shouldMove then break end. If you're using TweenService, call tween:Cancel() to stop the animation. If you're using AssemblyLinearVelocity, set it to Vector3.new(0, 0, 0) to stop the part.