My script moves a part up and down. I want it to make a part accelerate when starting to move and deaccelerate when getting close to the end.
I’m not sure which EasingStyle to use. I have tried a few but they didn’t give me the result I wanted. Based off of what I saw the script should give me the results I want but it’s not. The part accelerates but doesn’t deaccelerate.
I used this script:
local tweenService = game:GetService("TweenService")
local part = script.Parent
local info = TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out, 0 --[[the amount of times the tween repeats. Zero if you do not add it]], false --[[Tells the tween to reverse or not. False if you do not add it]])
local endPos = part.Position + Vector3.new(0, 0.25, 0)
local info2 = TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.In, 0 --[[the amount of times the tween repeats. Zero if you do not add it]], false --[[Tells the tween to reverse or not. False if you do not add it]])
local endPos2 = part.Position + Vector3.new(0, -0.25, 0)
local info3 = TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out, 0 --[[the amount of times the tween repeats. Zero if you do not add it]], false --[[Tells the tween to reverse or not. False if you do not add it]])
local endPos3 = part.Position + Vector3.new(0, -0.25, 0)
local info4 = TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.In, 0 --[[the amount of times the tween repeats. Zero if you do not add it]], false --[[Tells the tween to reverse or not. False if you do not add it]])
local endPos4 = part.Position + Vector3.new(0, 0.25, 0)
while true do
tweenService:Create(part, info, {Position = endPos}):Play()
task.wait(3)
tweenService:Create(part, info2, {Position = endPos2}):Play()
task.wait(3)
tweenService:Create(part, info3, {Position = endPos3}):Play()
task.wait(3)
tweenService:Create(part, info4, {Position = endPos4}):Play()
task.wait(3)
end