We use cookies on this site to enhance your user experience
Collapse Sidebar




Read-only property that includes information on how the interpolation of the Tween is to be carried out, using the TweenInfo data type. The TweenInfo data type includes a range of properties that can be used to achieve various styles of animation, including reversing and looping Tweens (see examples).

As with all Tween properties, the TweenInfo property is read only. If a developer wants to modify the TweenInfo of a Tween they must create a new Tween using TweenService/Create.

Code Samples

TweenInfo Examples

An example of the range of different interpolation effects that can be used in Tweens.

-- A TweenInfo with all default parameters
local default = TweenInfo.new() 
-- A TweenInfo with its time set to 0.5 seconds.
local timeChanged = TweenInfo.new(0.5) 
-- A TweenInfo with its easing style set to Back.
local easingStyled = TweenInfo.new(0.5, Enum.EasingStyle.Back) 
-- A TweenInfo with its easing direction set to In.
local easingDirected = TweenInfo.new(0.5, Enum.EasingStyle.Back,  Enum.EasingDirection.In) 
-- A TweenInfo that repeats itself 4 times.
local repeated = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 4) 
-- A TweenInfo that reverses its interpolation after reaching its goal.
local reverses = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 4, true)

-- A TweenInfo that loops indefinitely.
local reverses = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, -1, true)
-- A TweenInfo with a delay of 1 second between each interpolation.
local delayed = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 4, true, 1)

Looping a Tween

This code sample includes an example of how a looped tween can be created.

A part is instanced in the Workspace, and a Tween is created using TweenService:Create that is set to animate it’s position along the Y axis. The looped effect is achieved by modifying the TweenInfo used in TweenService:Create. Specifically, when RepeatCount is set to be less than 0 the tween will play indefinitely. Also, setting Reverses to true will cause the tween to play in reverse once it has reached it’s destination. In combination this creates a looped effect.

The correct way to make a tween play indefinitely is to set RepeatCount to -1. Developers should avoid using large numbers (or math.huge) as a substitute as this is unstable and may stop working at any point.

local TweenService = game:GetService("TweenService")

local part = Instance.new("Part")
part.Position = Vector3.new(0, 10, 0)
part.Anchored = true
part.Parent = game.Workspace
local tweenInfo = TweenInfo.new(
	2, -- Time
	Enum.EasingStyle.Linear, -- EasingStyle
	Enum.EasingDirection.Out, -- EasingDirection
	-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
	true, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime

local tween = TweenService:Create(part, tweenInfo, {Position = Vector3.new(0, 30, 0)})

tween:Cancel() -- cancel the animation after 10 seconds