Right now it's kind of buggy and it doesn't look smooth. Also the text reappears when the text fades out. Help Please!
Note: This script is put inside a text label.
Note: It's a LocalScript not a normal script.
Fade Script:
1 | for loop = 1 , 10 do |
2 | wait( 0.3 ) |
3 | script.Parent.BackgroundTransparency = loop/ 10 |
4 | wait( 0.3 ) |
5 | script.Parent.TextTransparency = loop/ 10 |
6 | game:GetService( "RunService" ).Stepped:Wait() |
7 | end |
8 | script.Parent.BackgroundTransparency = loop/ 10 |
I HIGHLY recommend using Tweening for this.
By using a Tween to animate the text, you can manipulate how the text fades out, what speed it fades at, and more within the TweenInfo. More about GUI-related tweening here.
if you dont know how to tween then:
01 | wait( 0.1 ) |
02 | script.Parent.BackgroundTransparency = 0.9 |
03 | wait( 0.1 ) |
04 | script.Parent.BackgroundTransparency = 0.8 |
05 | wait( 0.1 ) |
06 | script.Parent.BackgroundTransparency = 0.7 |
07 | wait( 0.1 ) |
08 | script.Parent.BackgroundTransparency = 0.6 |
09 | wait( 0.1 ) |
10 | script.Parent.BackgroundTransparency = 0.5 |
11 | wait( 0.1 ) |
12 | script.Parent.BackgroundTransparency = 0.4 |
13 | wait( 0.1 ) |
14 | script.Parent.BackgroundTransparency = 0.3 |
15 | wait( 0.1 ) |
16 | script.Parent.BackgroundTransparency = 0.2 |
17 | wait( 0.1 ) |
18 | script.Parent.BackgroundTransparency = 0.1 |
19 | wait( 0.1 ) |
20 | script.Parent.BackgroundTransparency = 0 |