TweenService

TweenService is a service in Roblox that allows you to create smooth animations for GUI elements, parts, and other objects. It is used to interpolate properties of an object from one state to another over a specified duration.

TweenA tween is an animation that interpolates the properties of an object from a start state to an end state.
TweenInfoThis defines the parameters of the tween, such as duration, easing style, easing direction, and repetition.
Easing Styles and DirectionsEasing styles define the mathematical function used to interpolate between the start and end values of the tween. Easing directions define how the tween progresses relative to the start and end values.

Tweenable Objects

PositionMove parts/models to a new location.
SizeChange the dimensions of parts/models.
OrientationRotate parts/models.
TransparencyAdjust the transparency level of parts/models.
ColorChange the color of parts/models.
PositionMove parts/models to a new location.
SizeChange the dimensions of parts/models.
BackgroundColor3Change the background color of GUI elements.
TransparencyAdjust the transparency level of parts/models.
BrightnessAdjust the brightness of a light source.
ColorChange the color of parts/models.
RangeChange the range of a light source.
CFrameMove or rotate the camera.
VolumeAdjust the volume of a sound.
PlaybackSpeedChange the playback speed of a sound.

TweenService Example

Tweening Position

local TweenService = game:GetService("TweenService")

-- Define TweenInfo
local tweenInfo = TweenInfo.new(
	2, -- Time (seconds)
	Enum.EasingStyle.Quad, -- Easing Style
	Enum.EasingDirection.Out, -- Easing Direction
	0, -- Repeat count (0 means no repeat)
	false, -- Reverses (tween goes back and forth)
	0 -- Delay time (seconds)
)

local part = script.Parent
part.Position = Vector3.new(0, 2.5, 0)
part.Anchored = true
part.Parent = workspace

-- Define the end state of the properties you want to tween
local goal = {}
goal.Position = Vector3.new(10, 5, 0)

-- Create the tween
local tween = TweenService:Create(part, tweenInfo, goal)

-- Play the tween
tween:Play()
Image 1
Roblox Studio

Tweening GUI Elements

local TweenService = game:GetService("TweenService")

-- Define TweenInfo
local tweenInfo = TweenInfo.new(
	2, -- Time (seconds)
	Enum.EasingStyle.Quad, -- Easing Style
	Enum.EasingDirection.Out, -- Easing Direction
	0, -- Repeat count (0 means no repeat)
	false, -- Reverses (tween goes back and forth)
	0 -- Delay time (seconds)
)

local part = script.Parent
part.Position = Vector3.new(0, 2.5, 0)
part.Anchored = true
part.Parent = workspace

-- Define the end state of the properties you want to tween
local goal = {}
goal.Position = Vector3.new(10, 5, 0)

-- Create the tween
local tween = TweenService:Create(part, tweenInfo, goal)

-- Play the tween
tween:Play()
Image 1
Roblox Studio

Tweening Light Properties

local TweenService = game:GetService("TweenService")

-- Define TweenInfo
local tweenInfo = TweenInfo.new(
	2, -- Time (seconds)
	Enum.EasingStyle.Quad, -- Easing Style
	Enum.EasingDirection.Out, -- Easing Direction
	0, -- Repeat count (0 means no repeat)
	false, -- Reverses (tween goes back and forth)
	0 -- Delay time (seconds)
)

local part = script.Parent
part.Position = Vector3.new(0, 2.5, 0)
part.Anchored = true
part.Parent = workspace

-- Define the end state of the properties you want to tween
local goal = {}
goal.Position = Vector3.new(10, 5, 0)

-- Create the tween
local tween = TweenService:Create(part, tweenInfo, goal)

-- Play the tween
tween:Play()
Image 1
Roblox Studio

Easing Styles

LinearMoves at a constant speed from start to end.
SineUses a sine wave for smooth, periodic motion.
BackOvershoots the end value before settling back.
QuadAccelerates quickly and then slows down.
CubicSimilar to Quad, but with a stronger acceleration and deceleration.
QuartEven stronger acceleration and deceleration than Cubic.
QuintThe strongest acceleration and deceleration.
BounceMimics a bouncing effect at the end.
ElasticMoves past the end value in a spring-like manner.
ExponentialStarts slowly and accelerates exponentially.
InStarts the tween slowly and speeds up towards the end.
OutStarts the tween quickly and slows down towards the end.
InOutCombines both 'In' and 'Out', starting slowly, speeding up in the middle, and slowing down again towards the end.