How to make fading text?

I want to make fading text, but I cannot understand the script.

I have tried text.transparency 0.1, 0.2 but that didn’t work either. This is starting to get confusing because I do not know the other lines of the script. The main text is when I want the text to fade then disappear. I really need help with this because I do not want the text to fully disappear and fade away instead of it disappearing.

3 Likes

UIgradient

1 Like

Please clarify, do u want to make your text fade out? Or do you want the color to fade to another color?

2 Likes

I dont understand what youre trying to say.

If you want to fade it with a script then

By what you explained I am guessing you just want the text to fade away slowly.

Try this-

local textLabel = script.Parent

for i = 0, 1, 0.01 do -- for loop
    wait()
    textLabel.TextTransparency = i --set transparency
end

--Put it inside your textLabel in a localScript

You can do the same with TweenService and I recommend doing that but It might get too complex to understand for you.

Or if youre talking about a still grading effect then

Use UIGradient

Here is a perfect acticle for it UI Layout and Appearance | Documentation - Roblox Creator Hub

1 Like

Well, you could do:

wait(5) -- waits 5 seconds before starting to fade

for fade = 1,100 do
    wait(0.01)
    script.Parent.TextTransparency = i/100
end

This would make your text fade out.

1 Like

Put a script into the textlabel and the script should have this inside of it
for i = 1,10 do
wait(.004)
script.Parent.TextTransparency = script.Parent.TextTransparency +.1
end

If you want it to fade out, do not use a for loop. Use TweenService.

local textLabel = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.TextLabel -- change this to wherever your TextLabel is that you want to fade out
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad) -- 1 is time

-- here is where you fade the text out.
tweenService:Create(textLabel, tweenInfo, {TextTransparency = 1}):Play()

Put that script into StarterPlayerScripts. You can connect to mouse click or whatever event you want to make the text fade out.

If you want to learn more about TweenService, read this: TweenService | Documentation - Roblox Creator Hub

You could use @DecodedMint’s solution, but using TweenService lets you get more creative with easing styles, time, etc., just TweenService is easier to use. But either one works.

6 Likes