Is there a better gui fading solution?

I’m trying to make a Gui fade away, I thought of using:

while true do
frame.BackgroundTransparency + 0.02
wait(0.05)
end

or

repeat
frame.BackgroundTranparency + 0.02
wait(0.05)
until frame.BackgroundTransparency == 1

i’ve also tried doing this:

tweenService:Create(
frame,
TweenInfo.new(2),
{BackgroundTransparency = 1}
):Play()

Isn’t there a better way to do this I want to ask?

local TweenService = game:GetService("TweenService")

local Frame = script.Parent.Frame

local DurationTransparency = 1 -- Seconds

TweenService:Create(Frame, TweenInfo.new(DurationTransparency), { BackgroundTransparency = 0 }):Play() -- BackgroundTransparency Property you want to disappear or appear = 0 ] - The number goes up to the one you put

--[[
If you put your frame in 0 De Transparency and put 1 instead of 0 it will do the time you put in TweenInfo(--Seconds), until it goes to 0
]]

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.