The simplest way to move a part forward is to change its Position property in a script
To make a part move forward in Roblox, you write a script that changes the part's Position property over time. The part moves in the direction its CFrame is facing — which is usually the positive Z-axis unless you've rotated it. You can do this with a loop that updates the position repeatedly, or by using TweenService for smoother, more controlled motion.
The two main approaches are: writing a loop that increments the position in small steps, or using TweenService to animate the movement over a set duration. Both work, but TweenService is smoother and easier to control because it handles the timing for you.
Key Takeaways
- A part moves forward by increasing its Position along the Z-axis (or whichever direction its CFrame faces), which you do inside a script placed in the part or in ServerScriptService.
- Using a while loop with small increments and wait() calls creates movement but can look jerky; TweenService produces smooth animation and is the standard approach.
- TweenService requires you to define a TweenInfo object with duration and easing style, then create and play the tween on the part's CFrame.
- Test movement in Studio by running the game and watching the part in the viewport; use the Properties panel to check the Position values as the script runs.
Moving a part with a simple loop
The most direct method is to place a script inside the part and use a loop. Inside the loop, you add a small number to the part's Position on the Z-axis, then pause briefly with wait() so the change happens over time rather than instantly.
Here is a basic example:
local part = script.Parent while true do part.Position = part.Position + Vector3.new(0, 0, 0.1) wait(0.05) end
This script moves the part 0.1 studs forward every 0.05 seconds. The Vector3.new(0, 0, 0.1) adds 0.1 to the Z value while leaving X and Y unchanged. Increase the 0.1 to move faster, or decrease it to move slower. The wait(0.05) controls how often the position updates — smaller numbers make movement smoother but use more processing power.
The downside of this approach is that the movement can look choppy if the wait time is too long, and it runs forever. To stop it, you need to add a condition or destroy the part.
Using TweenService for smooth movement
TweenService is the built-in Roblox tool for animating properties smoothly. It moves a part from one position to another over a duration you specify, with optional easing effects. This is the method used in most polished games because it looks professional and is easy to control.
Place this script in ServerScriptService or in the part itself:
local TweenService = game:GetService("TweenService") local part = script.Parent local tweenInfo = TweenInfo.new( 2, -- duration in seconds Enum.EasingDirection.InOut, -- easing direction Enum.EasingStyle.Quad -- easing style ) local targetPosition = part.Position + Vector3.new(0, 0, 10) local tween = TweenService:Create(part, tweenInfo, {Position = targetPosition}) tween:Play()
This script creates a tween that moves the part 10 studs forward over 2 seconds. The TweenInfo.new() defines how the animation behaves: the first number is duration, and the easing direction and style control how the motion feels. Enum.EasingStyle.Quad is a common choice that feels natural; other options include Linear (constant speed), Sine (smooth), and Bounce (bouncy).
To move the part multiple times, wrap the tween creation in a function and call it when you need movement:
local function movePartForward(distance, duration) local targetPosition = part.Position + Vector3.new(0, 0, distance) local tweenInfo = TweenInfo.new(duration, Enum.EasingDirection.InOut, Enum.EasingStyle.Quad) local tween = TweenService:Create(part, tweenInfo, {Position = targetPosition}) tween:Play() return tween end movePartForward(10, 2)
Moving a part relative to its rotation
If your part is rotated, moving it along the Z-axis will not move it in the direction it is facing. To move it forward relative to its own orientation, use CFrame instead of Position. CFrame includes both position and rotation, so you can move the part in its local forward direction.
Here is how to move a rotated part forward using CFrame:
local TweenService = game:GetService("TweenService") local part = script.Parent local tweenInfo = TweenInfo.new(2, Enum.EasingDirection.InOut, Enum.EasingStyle.Quad) local targetCFrame = part.CFrame * CFrame.new(0, 0, -10) -- move 10 studs forward local tween = TweenService:Create(part, tweenInfo, {CFrame = targetCFrame}) tween:Play()
The CFrame.new(0, 0, -10) moves the part in its local forward direction. Note that the Z value is negative — in Roblox's local coordinate system, negative Z is forward. If you want to move backward, use a positive Z value.
Detecting when movement is complete
When you play a tween, you often need to know when it finishes so you can trigger the next action. TweenService fires a Completed event when the tween ends.
Here is an example:
local tween = TweenService:Create(part, tweenInfo, {Position = targetPosition}) tween:Play() tween.Completed:Connect(function(playbackState) if playbackState == Enum.PlaybackState.Completed then print("Movement finished") end end)
The playbackState parameter tells you whether the tween completed normally or was cancelled. You can use this to chain movements together — move the part, wait for it to finish, then move it again.
Common issues and how to fix them
If a part is not moving, check that the script is in the right place. A script in the part itself uses script.Parent to reference the part. A script in ServerScriptService needs to find the part first, usually with game.Workspace:FindFirstChild("PartName") or by storing a reference to it.
If movement looks jerky with a loop, reduce the wait() time or switch to TweenService. If a tween is not working, make sure TweenService is defined with game:GetService("TweenService") at the top of your script. If the part moves but not in the direction you expect, check whether it is rotated — use CFrame instead of Position to move it relative to its own facing direction.
If multiple tweens are running on the same part at once, they will conflict. Cancel the previous tween before starting a new one by calling tween:Cancel() or by setting the tween variable to nil after it completes.
Frequently Asked Questions
How do I make a part move in a specific direction instead of forward?
Change the Vector3 values in the Position or CFrame calculation. Vector3.new(X, Y, Z) moves the part along those axes. For example, Vector3.new(5, 0, 0) moves it 5 studs to the right, and Vector3.new(0, 5, 0) moves it up. You can combine them: Vector3.new(5, 5, 5) moves diagonally.
Can I move a part and rotate it at the same time?
Yes, with TweenService. Instead of tweening only the Position, tween the CFrame and include both position and rotation. Use CFrame.Angles() to define the target rotation: local targetCFrame = CFrame.new(targetPosition) * CFrame.Angles(math.rad(90), 0, 0) rotates the part 90 degrees while moving it.
What is the difference between Position and CFrame?
Position is just the location of the part in 3D space. CFrame includes both position and rotation. Use Position when the part's rotation does not matter. Use CFrame when you need to move the part relative to its own facing direction or when you want to rotate it at the same time.
How do I make a part move back and forth?
Create two tweens — one to move forward and one to move back — and play them in sequence using the Completed event. Or use a loop that tweens to position A, waits for completion, tweens to position B, and repeats.
Does TweenService work on the client or server?
TweenService works on both. Server-side tweens are seen by all players. Client-side tweens are seen only by that player. For multiplayer games, use the server so all players see the same movement.