Tween
Last updated
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 (-1 for infinite)
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 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 (-1 for infinite)
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()...
Tween:Pause() -- Pause
wait(2)β
Tween:Play() -- Resume...
Tween:Cancel()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 (-1 for infinite)
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(playbackState)
print("Tween Complete!", playbackState)
end
Tween.Completed:Connect(OnCompleted)
Tween:Play()