Depending on what you’re trying to tween, I would experiment with lerping. Or try @CLL10K solution.
You can get the mid point by dividing the end position by 2, then checking if the instance’s tween property to check if it’s at half. Heres an example:
local start = 0
local end1 = 1
local current = 0
local midPoint = end1/2
while current ~= midPoint do
current += 0.1
print(current)
end
Heres another with part tweening:
local Part = workspace.Part
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(2)
local EndPosition = Part.Position + Vector3.new(0,10,0) -- Move 10 studs up
local MidPointY = EndPosition.Y/2 -- Get MidPoint
local Tween = TweenService:Create(Part, Info, {Position = EndPosition})
--Check if the part has reach mid point
coroutine.wrap(function()
while task.wait() do
print("Checking")
if Part.Position.Y >= MidPointY then
print("Part is at mid point")
Tween:Pause()
return
end
end
end)()
Tween:Play()
Another example with lerping:
local Part = workspace.Part
local StartCFrame = Part.CFrame
local EndGoal = StartCFrame * CFrame.new(0, 10, 0)
local Duration = 1
local CurrentTime = os.clock()
while task.wait() do
local Alpha = math.min((os.clock() - CurrentTime) / Duration, 1)
Part.CFrame = StartCFrame:Lerp(EndGoal, Alpha)
if Alpha >= 0.5 then return end
end
But the most simplest way, tween it half way :
local Part = workspace.Part
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(2)
local EndPosition = Part.Position + Vector3.new(0,10,0)
local MidPointY = EndPosition.Y/2
local Tween = TweenService:Create(Part, Info, {Position = Vector3.new(0, MidPointY, 0)})
Tween:Play()