And then you will have 2 options for it, you can either do this first one which waits for the completion of a tween and then plays another one to wait for it again and repeat.
while true do
Tween:Play(object, tweenInfo, goal)
Tween.Completed:Wait()
GoingBackTween:Play(object, tweenInfo, goal)
GoingBackTween.Completed:Wait()
end
The second option is for using the last tween info option which is the reversion.
local tweenInfo = TweenInfo.new(the other informations, true) -- The last one is reversion.
while true do
Tween:Play(obj, tweenInfo, goal)
Tween.Completed:Wait()
end
local frequency = 1
local tStart = os.clock()
while true do
wait()
local tElapsed = os.clock() - tStart
local position = math.sin(2 * math.pi * ((frequency * tElapsed) % 1))
local yourCFrame = point0:Lerp(point1, (position + 1)/2)
end
I’m using os.clock() instead of tick() as Roblox are most likely planning to deprecate tick().
local part = workspace.Part1
local part2 = workspace.Part2
local movingPart = workspace.movingPart
while true do
for i = 0, 1, 0.1 do
task.wait()
movingPart.CFrame = part.CFrame:Lerp(part.CFrame)
end
for i = 0, 1, 0.1 do
task.wait()
movingPart.CFrame = part2.CFrame:Lerp(part.CFrame)
end
end