Here's a complete script that will make your TextLabel fade in smoothly after 10 seconds, display for a while, and then fade out smoothly:
Using TweenService (Recommended for smooth transitions)
-- LocalScript inside the TextLabel or ScreenGui
local player = game:GetService("Players").LocalPlayer
local textLabel = script.Parent -- Change if script is not inside the TextLabel
local TweenService = game:GetService("TweenService")
-- Initial setup (invisible at start)
textLabel.Text = player.Name
textLabel.TextTransparency = 1 -- Fully transparent (invisible)
textLabel.TextStrokeTransparency = 1 -- Optional: Fade stroke if used
-- Wait 10 seconds before fading in
wait(10)
-- Fade IN (becomes visible)
local fadeInTween = TweenService:Create(
textLabel,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ TextTransparency = 0, TextStrokeTransparency = 0 } -- Fully visible
)
fadeInTween:Play()
-- Wait 5 seconds after fading in (adjust as needed)
wait(5)
-- Fade OUT (becomes invisible again)
local fadeOutTween = TweenService:Create(
textLabel,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ TextTransparency = 1, TextStrokeTransparency = 1 } -- Fully transparent
)
fadeOutTween:Play()
-- Optional: Destroy the label after fading out
fadeOutTween.Completed:Connect(function()
textLabel:Destroy()
end)
Alternative (Manual Fading with Loops)
If you prefer not to use TweenService, here's a manual version:
local player = game:GetService("Players").LocalPlayer
local textLabel = script.Parent
-- Initial setup (invisible)
textLabel.Text = player.Name
textLabel.TextTransparency = 1
-- Wait 10 seconds before fading in
wait(10)
-- Fade IN (smoothly)
for i = 1, 30 do
textLabel.TextTransparency = 1 - (i / 30)
wait(0.03) -- Adjust for smoother/faster fade
end
-- Wait 5 seconds (adjust as needed)
wait(5)
-- Fade OUT (smoothly)
for i = 1, 30 do
textLabel.TextTransparency = i / 30
wait(0.03)
end
-- Optional: Destroy after fading
textLabel:Destroy()
How to Use:
- Place the script inside your TextLabel (or modify
script.Parent if it's elsewhere).
- Adjust timings (
wait(10), wait(5)) to control when fading happens.
- Optional: Remove
:Destroy() if you want to keep the label but just make it invisible.
This will make your TextLabel smoothly appear after 10 seconds, stay visible for a while, and then fade out smoothly. 🚀