Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

GUI Tweening Issues: How to smoothly animate this?

Asked by 8 years ago

Hello.

For a project I'm working on, there is a general purpose Timer GUI that is supposed to show time remaining.

Here is my code for it: The timer bar is located under StarterGui -> gameGui -> FloatTop -> gBar

    if Request == "countDown" then
        gText.Text = "Intermission" 
        gG.Visible = true
        gR.Visible = false

        gBar.Size = UDim2.new(1.087,0,0,4) -- Timer, original size
        gBar:TweenSize(UDim2.new(0,0,0,4), "InOut", "Linear", 15) -- Timer, new size, 15 sec. later

        for i = 15, 1, -1 do
            gTimer.Text = i
            wait(1)
        end
    end

The problem is, it doesn't seem to work. How can I animate this line so it goes from size (1.087, 0, 0, 4) to (0, 0, 0, 4) in 15 seconds, smoothly?

Answer this question