Comprehensive Guide to Roblox TweenInfo & TweenService
Master smooth, professional animations in Roblox Studio using TweenInfo and TweenService. This guide covers constructor syntax, all 11 EasingStyles, EasingDirections, chained animations, responsive UI tweening, and common anti-patterns.
1. What is TweenInfo?
In Roblox Luau development, TweenInfo is an immutable (read-only) data structure that defines the timing, motion dynamics, and repetition behavior of an animation. It acts as the configuration blueprint passed directly into TweenService:Create().
The TweenInfo.new() Constructor
The constructor accepts up to six optional arguments. If omitted, default values are automatically assigned:
local tweenInfo = TweenInfo.new(
time, -- number (Default: 1)
easingStyle, -- Enum.EasingStyle (Default: Enum.EasingStyle.Quad)
easingDirection, -- Enum.EasingDirection (Default: Enum.EasingDirection.Out)
repeatCount, -- number (Default: 0)
reverses, -- boolean (Default: false)
delayTime -- number (Default: 0)
)Argument Specifications
| # | Argument | Type | Default | Role |
|---|---|---|---|---|
| 1 | time | number | 1 | Duration (seconds) of a single animation cycle. |
| 2 | easingStyle | EasingStyle | Quad | The easing curve governing acceleration/deceleration. |
| 3 | easingDirection | EasingDirection | Out | Where the curve applies: In, Out, or InOut. |
| 4 | repeatCount | number | 0 | Repeats after the first run. Use -1 for continuous looping. |
| 5 | reverses | boolean | false | When true, auto-reverses (yoyo) back to the start. |
| 6 | delayTime | number | 0 | Wait time (seconds) before playback begins. |
Immutability Notice
All properties of a TweenInfo instance are read-only after instantiation:
local tweenInfo = TweenInfo.new(1)
-- Runtime Error: Property 'Time' is read-only
-- tweenInfo.Time = 2To alter timing or motion curves, instantiate a new TweenInfo object. Likewise, an active Tween cannot be modified on the fly — create a new Tween instance whenever target properties change.
2. Understanding EasingStyle and EasingDirection
Combining EasingStyle and EasingDirection shapes the motion dynamics—transforming rigid, linear transitions into organic, fluid movements.
The 11 EasingStyle Options
| EasingStyle | Motion Characteristics & Best Use Cases |
|---|---|
Linear | Constant speed throughout. Ignores EasingDirection. Best for rotating loading indicators or marquee text. |
Sine | Smooth, sinusoidal acceleration/deceleration. Ideal for gentle floating elements or breathing UI effects. |
Quad | Quadratic interpolation (default). Slightly sharper acceleration curve than Sine. Great for standard UI transitions. |
Cubic | Cubic interpolation. Sharper curve than Quad. Excellent for snappy buttons and pop-up modals. |
Quart | Quartic interpolation. Sharper than Cubic for dramatic UI entries. |
Quint | Quintic interpolation. Very sharp acceleration, ideal for rapid slide-in animations. |
Exponential | Exponential curve with extreme acceleration/deceleration. Perfect for high-speed dashes or warp effects. |
Circular | Circular arc curve. Rapid initial acceleration followed by gentle deceleration. |
Back | Overshoots the target value slightly before settling back. Great for springy UI pop-ups and notifications. |
Bounce | Bounces multiple times against the target boundary upon arrival. Ideal for falling objects and physical impacts. |
Elastic | Rubber-band oscillation effect, overshooting target multiple times. Excellent for whimsical or playful UI feedback. |
The 3 EasingDirection Options
| EasingDirection | Application Phase |
|---|---|
In | Applies the curve at the start (accelerates slowly). |
Out | Applies the curve at the end (decelerates smoothly, default). |
InOut | Applies easing at both start and end. |
Note on Linear: Because Enum.EasingStyle.Linear represents a constant rate of change, setting EasingDirection to In, Out, or InOut has no visual effect.
Configuration Examples
-- Smooth bounce deceleration upon arrival
local bounceOut = TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)
-- Springy overshoot upon startup
local backIn = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In)
-- Constant speed linear movement (EasingDirection is ignored)
local linearMotion = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)3. Implementing Animations with TweenService
TweenServiceis Roblox's built-in service for interpolating property values smoothly over time.
Basic Implementation Workflow
Direct instantiation via Instance.new("Tween") is invalid. Always construct tweens using TweenService:Create(), which takes three parameters: the target instance, a tweenInfo configuration, and a propertyTable of target property values.
local TweenService = game:GetService("TweenService")
local part = workspace:WaitForChild("Part")
local tweenInfo = TweenInfo.new(
1,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out
)
local propertyTable = {
Position = Vector3.new(0, 10, 0),
Transparency = 0.5
}
local tween = TweenService:Create(part, tweenInfo, propertyTable)
-- Explicit Play call required:
tween:Play()Supported Property Data Types
TweenService interpolates properties of the following types: number, boolean, CFrame, Color3, UDim/UDim2, Vector2/Vector2int16, Vector3, Rect, and EnumItem. Multiple properties can be interpolated simultaneously within a single property dictionary.
Playback Control Methods
| Method | Behavior |
|---|---|
:Play() | Begins or resumes playback from the current state. |
:Pause() | Halts playback, freezing values at the current frame. |
:Cancel() | Stops immediately, leaving values at their current state. |
Sequential Animations (Chained Tweens)
To trigger consecutive animations on completion, connect a listener to the .Completed signal:
local moveTween = TweenService:Create(part, tweenInfo, {
Position = Vector3.new(0, 10, 0)
})
local rotateTween = TweenService:Create(part, tweenInfo, {
CFrame = CFrame.Angles(0, math.rad(90), 0)
})
-- Chain rotateTween after moveTween finishes
moveTween.Completed:Connect(function(playbackState)
if playbackState == Enum.PlaybackState.Completed then
rotateTween:Play()
end
end)
moveTween:Play()4. Common Pitfalls & Anti-Patterns
4.1 Avoid math.huge for Continuous Looping
Do not pass math.huge or arbitrarily large numbers to repeatCountfor continuous looping. Because Lua/Luau casts this value to an integer, the actual result is platform-dependent — on some environments it wraps to a large negative number (looping effectively forever), while on others it caps at a large positive integer. Either way, it's not something to rely on.
The correct, explicit way to loop continuously is -1:
-- Correct infinite loop configuration
local infiniteTweenInfo = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
-1, -- -1 specifies infinite repetition
true -- Auto-reverses (yoyo)
)4.2 Property Collisions and Tween Overriding
When two tweens target the exact same property on the same instance, the newly played tween automatically overrides and cancels the earlier one. The property transitions seamlessly from its current interpolated value toward the new target.
-- Anti-pattern: tween1 is instantly overridden and cancelled by tween2
tween1:Play()
tween2:Play()
-- Correct approach: run sequentially via the .Completed signal
tween1.Completed:Connect(function()
tween2:Play()
end)
tween1:Play()Note: updating different properties (e.g. Position and Color) across simultaneous tweens is fully supported and safe.
4.3 Untriggered Tweens (Missing :Play())
Calling TweenService:Create() only constructs the Tween object in memory — it does not auto-start playback. You must explicitly invoke :Play().
4.4 Mutating Read-Only Properties
Instantiated TweenInfo configs and active Tween instances are read-only. Construct a new instance with the updated settings instead of mutating properties directly.
4.5 Responsive UI Tweening Best Practices
- Scale-based positioning: set
AnchorPoint(e.g.Vector2.new(0.5, 0.5)) and useUDim2.fromScale(x, y)for resolution-independent positioning across PC, mobile, and console. - Aspect ratio preservation: attach a
UIAspectRatioConstraintto prevent UI distortion during size scaling. - Group alpha fading: tween the
GroupTransparencyof a parentCanvasGroup, orUIStroke.Transparency, to fade complex UI hierarchies without overlap artifacts.
5. Harnessing the Roblox Tween Generator
The Roblox Tween Generator is a free, web-based utility for visually tweaking parameters, observing real-time preview dynamics, and generating production-ready Luau scripts.
Key Advantages
- Interactive tuning: visually calibrate Time, EasingStyle, and EasingDirection with real-time feedback.
- Instant Luau output: generates clean, copy-pasteable script blocks instantly.
- 100% client-side processing: runs entirely in your browser with zero server-side data logging or code transmission.
Visual Preview Scope vs. Code Output
To maintain zero-latency browser performance, the visual canvas previews Time, EasingStyle, and EasingDirection. Parameters like RepeatCount, Reverses, and DelayTime are included directly in the generated Luau code, so you can test looping and delay behavior inside Roblox Studio.
Recommended Developer Workflow
- Open the Roblox Tween Generator in your browser.
- Adjust Time, EasingStyle, and EasingDirection while reviewing the live canvas animation.
- Configure RepeatCount, Reverses, and DelayTime in the settings panel as needed.
- Copy the generated Luau code and paste it into your Roblox Studio script (Script or LocalScript).
- Ensure target instances match your workspace hierarchy, and verify
:Play()is invoked.
6. Pre-Implementation Checklist
Before publishing your script, run through this checklist:
- Are all six TweenInfo.new() arguments in the correct order?
- Is continuous looping set to -1 rather than math.huge?
- Did you construct the animation via
TweenService:Create()instead ofInstance.new("Tween")? - Is :Play() explicitly invoked after tween creation?
- Are simultaneous tweens on the same instance targeting different properties to prevent overrides?
- Are UI animations using AnchorPoint and UDim2.fromScale() for responsive scaling?
- Is complex UI fading handled via CanvasGroup.GroupTransparency?
- Are sequential animations properly chained using the .Completed signal?
Want to see the real motion while you build the code? Try the Roblox Tween Generator to preview your settings and generate the matching TweenInfo code.
Open Tween Generator