How can I check how much time is left on a tween?

Hello, so i’m making this thing and I was wondering how I could see how much time is left on the tween. Is it possible? Any help is appreciated

1 Like

heres my script btw

local TweenService = game:GetService("TweenService")
local Goals = {
	Size = Vector3.new(220,1,10)
}
local Info = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 3)
local Tween = TweenService:Create(script.Parent, Info, Goals)
Tween:Play()
1 Like

im not really sure if theres an official method BUT thats besides the point heres a method to measure

local StartTime = 0
local FinishTime = 0
StartTime = tick()
--then start the tween 
tween.Completed:Connect(function(playbackState)
	if playbackState == Enum.PlaybackState.Completed then
		FinishTime = tick()
        print("Tween Duration =", FinishTime-StartTime)
	end
end)

so run the code and once the tween is done it will print out the duration of time it takes
COPY THIS PRINTED VALUE

local TweenDuration = --print the value here 
local Start = 0
local HowMuchTimeIsLeft = 0 
Start = tick()
--start the tween 
HowMuchTimeIsLeft = tick() - Start

this should give you the all the building blocks you need really

2 Likes

i’ll try it. Give me a second Preformatted text

1 Like

also yet another side note this will give you the amount of time left in seconds
if you want a percentage it wouldnt be so hard either

2 Likes

ok so this kinda works. But how can I see like the current time a tween is on? If thats even possible?

1 Like

like how complete the tween is you mean?

1 Like

you simply divide the TweenDuration by HowMuchTimeIsLeft and that will give you the percantage as a decimal of how complete your tween is

2 Likes

let me try that. Thank you so much for your help btw

2 Likes