Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you tween a UI Object's transparency?

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

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()

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 ]] })

This discussion is preserved as it was. New answers, comments, and votes are closed.