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

How do I make my ui fade to appear (1-0)?

Asked by 3 years ago

The transparency needs to go from 1-0

local frame = script.parent


I know it has something to do with

For i in i

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

You can use TweenService to tween the transparency property smoothly into 0. TweenService can also tween other properties such as Color3

local frame = script.Parent

local tweenService = game:GetService('TweenService')

local timeout = 1 -- will tween within 1 second

function fade(transparency)
    tweenService:Create(frame, TweenInfo.new(timeout), { Transparency = transparency }):Play()
end

fade(0)

If you want to fade it to 0 with for loop you can do this

local frame = script.Parent

function fade()
    for i = 1, 0, -0.1 do
        frame.Transparency = i
        wait(0.1)
    end
end

spawn(fade)
Ad

Answer this question