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

How do I scale UI over a period of time?

Asked by 1 year ago
Edited 1 year ago

Currently I have this little cooldown GUI that I am making for a dash. The first part of the bar going down works perfect, but going back up I want it to go for 4 seconds to lineup with the cooldown. How would I do that? Here is my script:

print("Yippee") -- Testing

script.Parent:TweenSize(UDim2.new(0,0,0,20)) -- Bar going down

wait(1) -- Timing the transparency correctly

script.Parent.Transparency = 1

wait(3.5) -- Testing purposes, Will change to 0.1 after I get this fixed

script.Parent.Transparency = 0

script.Parent:TweenSize(UDim2.new(0,115,0,20)) -- Bar moving back up, the problem since I dunno how to do time

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

You can use the time parameter.

TweenSize(endSize, easingDirection, easingStyle, time, override, callback)

It should look like this:

-- "Out" is the default for easingDirection, and "Quad" is the default for easingStyle
script.Parent:TweenSize(UDim2.new(0, 115, 0, 20), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 4)

Final Script:

print("Yippee") -- Testing

script.Parent:TweenSize(UDim2.new(0,0,0,20)) -- Bar going down

wait(1) -- Timing the transparency correctly

script.Parent.Transparency = 1

wait(3.5) -- Testing purposes, Will change to 0.1 after I get this fixed

script.Parent.Transparency = 0

script.Parent:TweenSize(UDim2.new(0, 115, 0, 20), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 4)
Ad

Answer this question