Creator Guide
English
English
  • OVERDARE
    • 🚩Introduction to OVERDARE
    • 🐤Get Started
      • OVERDARE App
      • OVERDARE Studio
    • 📌Policy
      • Community Guidelines
      • UGC Creation Guidelines
      • Guidelines on the External Use of UGC
      • Logo Usage Guidelines
      • Intellectual Property Rights Policy
      • Reporting Guidelines
      • Guidelines on Disputing Suspensions and Bans
      • Creator Payout Policy
      • Monetization Guidelines
    • 🅰️OVERDARE Glossary
  • MANUAL
    • 🏰Studio Manual
      • Get Started
        • Studio Interface
        • World Template
        • Coordinate System
        • Studio Test Play
        • World Publish
        • Collaboration
      • Asset & Resource Creation
        • Asset Import
        • Animation Editor
      • Game Development
        • Game Settings
        • Script Editor
        • Align Tool
        • Material Manager
        • Collision Groups
        • Tag Editor
        • Performance Guide
      • Object
        • Part
        • Model
        • Camera
        • Physics
        • Lighting
        • Tool
        • VFX
        • Sound
      • Character
        • Character Animation
        • Humanoid Description
      • GUI
    • 📝Script Manual
      • Get Started
        • Script Overview
        • Basic Guide to Lua
        • Coding Style
        • Object Reference
        • Unity Developer Guide
      • Events & Communication
        • Event
        • Server-Client Communication
        • BindableEvent
        • Value Objects
      • Input & Controls
        • Mobile Input Handling
        • TPS Strafing System
      • Advanced Gameplay Systems
        • Saving & Loading Data
        • Tween
        • Module Script
      • Debugging & Optimization
        • Breakpoint
        • Practical Guide to Script Optimization
  • 💸Monetization
    • Payout Guideline
  • DEVELOPMENT
    • 📚API Reference
      • Enums
        • ActuatorRelativeTo
        • AnimationPriority
        • AspectType
        • AssetTypeVerification
        • BorderMode
        • CameraMode
        • CameraType
        • ContextActionResult
        • CoreGuiType
        • DominantAxis
        • EasingDirection
        • EasingStyle
        • ForceLimitMode
        • HttpCompression
        • HttpContentType
        • HumanoidDisplayDistanceType
        • HumanoidStateType
        • KeyCode
        • Material
        • MaterialPattern
        • NormalId
        • ParticleEmitterShape
        • ParticleEmitterShapeInOut
        • ParticleEmitterShapeStyle
        • ParticleFlipbookLayout
        • ParticleFlipbookMode
        • ParticleOrientation
        • PartType
        • PlaybackState
        • RaycastFilterType
        • RollOffMode
        • RotationType
        • UserInputState
        • UserInputType
        • VelocityConstraintMode
      • DataTypes
        • BlendSpaceSampleSata
        • BrickColor
        • CFrame
        • Color3
        • ColorSequence
        • ColorSequenceKeypoint
        • Content
        • Enum
        • EnumItem
        • NumberRange
        • NumberSequence
        • NumberSequenceKeypoint
        • OverlapParams
        • PhysicalProperties
        • Ray
        • RaycastParams
        • RaycastResult
        • ScriptConnection
        • ScriptSignal
        • TweenInfo
        • Udim
        • Udim2
        • Vector2
        • Vector3
      • Classes
        • Animation
        • AngularVelocity
        • AnimationTrack
        • Animator
        • Atmosphere
        • Attachment
        • Backpack
        • BackpackItem
        • BasePart
        • BaseScript
        • Beam
        • BindableEvent
        • BlendSpace
        • BoolValue
        • Bone
        • Camera
        • CharacterMesh
        • CollectionService
        • Constraint
        • ContextActionService
        • CoreGui
        • DataStore
        • DataModel
        • DataStoreGetOptions
        • DataStoreIncrementOptions
        • DataStoreInfo
        • DataStoreKeyPages
        • DataStoreKeyInfo
        • DataStoreService
        • DataStoreListingPages
        • DataStoreSetOptions
        • FormFactorPart
        • Frame
        • Folder
        • GlobalDataStore
        • GuiBase2d
        • GuiButton
        • GuiObject
        • HttpService
        • Humanoid
        • HumanoidDescription
        • ImageButton
        • ImageLabel
        • InputObject
        • IntValue
        • LayerCollector
        • Instance
        • Light
        • Lighting
        • LinearVelocity
        • LocalScript
        • LuaSourceContainer
        • MaterialService
        • MaterialVariant
        • MeshPart
        • Model
        • ModuleScript
        • Mouse
        • OrderedDataStore
        • Pages
        • Part
        • ParticleEmitter
        • PhysicsService
        • Player
        • PlayerGui
        • Players
        • PlayerScripts
        • PointLight
        • PVInstance
        • ReplicatedStorage
        • RemoteEvent
        • ScreenGui
        • RunService
        • Script
        • ServerStorage
        • ServiceProvider
        • Skeleton
        • ServerScriptService
        • Sound
        • SoundService
        • SoundGroup
        • SpotLight
        • SpawnLocation
        • StarterCharacterScripts
        • StarterPack
        • StarterGui
        • StarterPlayer
        • StarterPlayerScripts
        • StringValue
        • SurfaceGui
        • SurfaceGuiBase
        • Team
        • Teams
        • TextLabel
        • TextButton
        • Tool
        • Trail
        • Tween
        • TweenService
        • TweenBase
        • UIAspectRatioConstraint
        • UserGameSettings
        • UserInputService
        • UserSettings
        • VectorForce
        • Workspace
        • WrapLayer
        • WorldRoot
        • WrapTarget
  • UPDATE
    • 📰Release Note
Powered by GitBook
On this page
  • Overview
  • Features
  • Components
  • How to Use
  • 1. Creating a Tween
  • 2. Setting Properties to Be Changed With the Tween
  • 3. Running the Tween
  • 4. Controlling the Tween Execution
  • 5. Handling Events After the Tween Ends
  • EasingStyle
  • EasingDirection
  1. MANUAL
  2. Script Manual
  3. Advanced Gameplay Systems

Tween

Overview

Tween is used to smoothly and naturally change the properties of an object. By using Tween, various properties such as the object’s position, rotation, and size can be animated, adding immersive and rich visual effects to the game.

Features

  • Tweens excel in both code simplicity and performance, helping to easily implement various effects.

  • Tweens support various Easing styles, providing smooth and natural animations.

  • Tweens are processed internally in an efficient manner, and their performance overhead is lower compared to frame-by-frame updates.

  • Tweens automatically terminate once completed, and subsequent tasks can be easily handled in the Completed event.

Components

  • TweenService: The service used to create and manage tweens.

  • TweenInfo: An object that defines how the tween behaves, including settings for duration, direction, and repeat count.

  • TweenGoals: Defines the property values to be changed by the tween.

How to Use

1. Creating a Tween

You can define the behavior of a tween animation, such as its duration, easing style, and repeat count, using the TweenInfo.new function.

The properties to which the animation will be applied, such as the object’s position or rotation, are set in the TweenGoals table.

local TweenService = game:GetService("TweenService")
local Part = script.Parent

-- Setting Tween information
local TweenInfoData = TweenInfo.new(
    2,                        -- Easing duration (seconds)
    Enum.EasingStyle.Linear,  -- Easing style
    Enum.EasingDirection.Out, -- Easing direction
    0,                        -- Number of repetitions
    false,                    -- Whether to reverse
    0                         -- Wait time
)

-- Properties to be changed with the tween
local TweenGoals = 
{
    Position = Vector3.new(-400, 50, -350)
}

local Tween = TweenService:Create(Part, TweenInfoData, TweenGoals)

2. Setting Properties to Be Changed With the Tween

The functionality of the tween varies depending on the properties set in the TweenGoals.

local TweenGoals = 
{
    Position = Vector3.new(-400, 50, -350)
}
local TweenGoals = 
{
    Orientation = Vector3.new(0, 180, 0)
}
local TweenGoals = 
{
    Size = Vector3.new(200, 200, 200)
}
local TweenGoals = 
{
    Color = Color3.new(0.5, 0, 0)
}
local TweenGoals = 
{
    CanCollide = false
}

3. Running the Tween

You can create a tween by passing the target object, the pre-configured TweenInfo, and TweenGoals to the TweenService:Create function. Once the tween is created, it can be executed using the Play function.

local TweenService = game:GetService("TweenService")
local Part = script.Parent

-- Setting Tween information
local TweenInfoData = TweenInfo.new(
    2,                        -- Easing duration (seconds)
    Enum.EasingStyle.Linear,  -- Easing style
    Enum.EasingDirection.Out, -- Easing direction
    0,                        -- Number of repetitions
    false,                    -- Whether to reverse
    0                         -- Wait time
)

-- Properties to be changed with the tween
local TweenGoals = 
{
    Position = Vector3.new(-400, 50, -350)
}

local Tween = TweenService:Create(Part, TweenInfoData, TweenGoals)

Tween:Play()

4. Controlling the Tween Execution

A tween that is running can be paused using the Pause function.

...
Tween:Pause() -- Pause
wait(2)​
Tween:Play()  -- Resume

The Cancel function can be used to cancel a running tween.

...
Tween:Cancel()

5. Handling Events After the Tween Ends

The Completed event can be used to handle actions after a tween finishes executing.

local TweenService = game:GetService("TweenService")
local Part = script.Parent

-- Setting Tween information
local TweenInfoData = TweenInfo.new(
    2,                        -- Easing duration (seconds)
    Enum.EasingStyle.Linear,  -- Easing style
    Enum.EasingDirection.Out, -- Easing direction
    0,                        -- Number of repetitions
    false,                    -- Whether to reverse
    0                         -- Wait time
)

-- Properties to be changed with the tween
local TweenGoals = 
{
    Position = Vector3.new(-400, 50, -350)
}

local Tween = TweenService:Create(Part, TweenInfoData, TweenGoals)

local function OnCompleted()
    print("Tween Complete!")
end
Tween.Completed:Connect(OnCompleted)

Tween:Play()

EasingStyle

EasingDirection

PreviousSaving & Loading DataNextModule Script

Last updated 1 day ago

📝