Make a part that can tween up and down

We don’t need to overcomplicate things. Instead, we can play the two tweens into a while true do loop in a LocalScript.
Also, in this quote:

You can use EasingStyle.Exponential inside of the tweenInfoTranslate variable like so:

--// This code is almost matched to fit your style of coding
local TweenService = game:GetService("TweenService")

local tweenInfoTranslate = TweenInfo.new(translationSpeed, Enum.EasingStyle.Exponential, Enum.EasingDirection.In)

local goalTranslation = {Position = defaultPartPosition + Vector3.new(0, 3, 0)}
local goalTranslation2 = {Position = defaultPartPosition + Vector3.new(0, -3, 0)}

local translatePart = TweenService:Create(part, tweenInfoTranslate, goalTranslation)
local translatePart2 = TweenService:Create(part, tweenInfoTranslate, goalTranslation2)

while true do
	translatePart:Play()
	translatePart:Wait() -- waits until translatePart finishes
	translatePart2:Play()
	translatePart2:Wait() -- waits until translatePart2 finishes
end

If you wanted to get even simpler, you can just set the RepeatCount property to -1 and the Reverse property to true. This would cause it to repeat indefinitely and reverse the tween:

local TweenService = game:GetService("TweenService")
local tweenInfoTranslate = TweenInfo.new(
    translationSpeed, -- Time
    Enum.EasingStyle.Exponential, -- EasingStyle
    Enum.EasingDirection.InOut, -- EasingDirection
    -1, -- RepeatCount
    true -- Reverses
)
local goalTranslation = {CFrame = part.CFrame * CFrame.new(0,3,0)}

-- Create and play the tween in the same line!
TweenService:Create(part, tweenInfoTranslate, goalTranslation):Play()
1 Like

I found a kit yesterday on GFX and Aura that contains the thing I wanted to achieve it did my job more perfectly