Collapse Sidebar


The Completed event of a Tween fires when the tween finishes playing. This will happen either when the tween naturally finishes playing, or if it is stopped with TweenBase/Cancel.

A function connected to this event will be passed the PlaybackState of the tween when it finished to give indication about why the tween ended. If the tween finishes naturally the status will be Completed, if cancelled then the state will be Cancelled. Note that calling TweenBase/Pause will not fire the Completed event.


Name Type Default Description

The Enum/PlaybackState of the tween upon completion.

Code Samples

Tween Completed

In this example the walkspeed of any player joining the game will be slowed to 0 over 10 seconds using a Tween. The Completed event is used to reset the walkspeed after the Tween has finished playing.

local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local SLOW_DURATION = 10
local function slowCharacter(humanoid)
	local goal = {}
	goal.WalkSpeed = 0
	local tweenInfo = TweenInfo.new(SLOW_DURATION)	
	local tweenSpeed = TweenService:Create(humanoid, tweenInfo, goal)
	return tweenSpeed
local function onCharacterAdded(character)
	local humanoid = character:WaitForChild("Humanoid")
	local initialSpeed = humanoid.WalkSpeed
	local tweenSpeed = slowCharacter(humanoid)
	humanoid.WalkSpeed = initialSpeed
local function onPlayerAdded(player)

Tween Conflict

This code sample includes a demonstration of tween conflict. A part is instanced in the Workspace, and two tweens are created that attempt to move the part in conflicting directions.

When both tweens are played, the first tween is cancelled and overwritten by the second tween. This can be seen as the part moves along the Y axis as opposed to the Z axis.

To further demonstrate this, connections have been made for both tweens to the Tween.Completed event. Upon playing the tweens, the following is printed.

tween1: Enum.PlaybackState.Cancelled
tween2: Enum.PlaybackState.Completed

These prints show that the first tween was cancelled (firing the Completed event) immediately upon the second tween being played. The second tween then went on to play until completion.

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(5)

-- create two conflicting tweens (both trying to animate part.Position)
local tween1 = TweenService:Create(part, tweenInfo, {Position = Vector3.new(0, 10, 20)})
local tween2 = TweenService:Create(part, tweenInfo, {Position = Vector3.new(0, 30, 0)})

-- listen for their completion status
	print("tween1: "..tostring(playbackState))
	print("tween2: "..tostring(playbackState))

-- try to play them both

Verifying a Tween has Completed

This code sample includes an example of how Tween.Completed can be used to determine if a Tween has been successfully completed, or cancelled.

In this case a part is instanced and tweened towards 0, 0, 0. Once the tween has completed, if the final PlaybackState is Completed then the part will explode. Were the tween to be cancelled prior to completion, the explosion would not be created.

This method can be used to link tweens to other effects, or even chain several tweens to play after each other.

local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")

local part = Instance.new("Part")
part.Position = Vector3.new(0, 50, 0)
part.Anchored = true
part.Parent = game.Workspace
local goal = {}
goal.Position = Vector3.new(0, 0, 0)
local tweenInfo = TweenInfo.new(3)
local tween = TweenService:Create(part, tweenInfo, goal)

	if playbackState == Enum.PlaybackState.Completed then
		local explosion = Instance.new("Explosion")
		explosion.Position = part.Position 
		explosion.Parent = game.Workspace 
		Debris:AddItem(explosion, 2)