Scale a Frames size as a Timer value decreases

So i have a timer bar that i want to scale down as the timer value decreases but i have no idea on how to do it properly. I’ve tried many times but it always end up failing (timer just decides to start scaling the bar the last 10 seconds, doesn’t scale it at all, or it scales it weirdly)

Just a basic script to test it:

local TimerValue = 30

while wait(1) do

TimerValue = TimerValue - 1

script.Parent.Size = UDim2.new()

end

Screenshot_2407
I want the Bar frame scale inwards as the TimerValue decreases.
Screenshot_2406
I know how to change the scale that but I don’t know what calculations I have to do to get the new size of the bar. Some help would be appreciated.

You can use the TweenService and set the tween time to 30 seconds. Hope this helps.

1 Like