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

How do you tween a UI Object's transparency?

Asked by 4 years ago

So I want to use TweenService to get a smooth fade out and in, but I can't remember how you use tweens to change a background transparency. Any help is appreciated.

2 answers

Log in to vote
0
Answered by 4 years ago
local Frame = script.Parent -- Define your UI Object

TweenService:Create(Frame, -- Name of your UI Object
    TweenInfo.new(1), -- Amount of time it takes for the tween to complete
    {BackgroundTransparency = 0}) -- Goal; what you want the tween to do
    :Play()

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Like you would any other property.

local tweenSrv = game:GetService('TweenService')

local tween = tweenSrv:Create(--[[Your GUI object]], TweenInfo.new(
    --[[ Amount of time it will take for the tween to complete ]],
    --[[ Easing style ]],
    --[[ Easing direction ]],
    -- The other parameters if you need them
), {BackgroundTransparency = --[[ The value of which this property should be set to when the tween ends ]] })

Answer this question