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

[GUI] How to fade away text from GUI?

Asked by 10 years ago

So far I have made the script so it clones the GUI into the players starterGUI, however, I wan't the gui text to fade away after a couple seconds. This is what I have;

`local Gui = game.Lighting.Gui1

function GiveGui(Player)
if Player.PlayerGui:FindFirstChild(Gui.Name)~=nil then return end
Gui:Clone().Parent=Player.PlayerGui
end

script.Parent.Touched:connect(function(hit)

local Player=game.Players:GetPlayerFromCharacter(hit.Parent)
if Player==nil then return end
GiveGui(Player)

end)`

I want to add a function that calls the gui transparency specifically to the text. and slowly and seemily fades away, however i cant do this, could anyone help me?

3 answers

Log in to vote
0
Answered by 10 years ago
game.StarterGUI.GUI.Frame.Text.Transparency = 0.9
wait(--INSERT LEGNTH HERE)
game.StarterGUI.GUI.Frame.Text.Transparency = 0.8

Correct me if I am wrong. As I am a novice myself.

0
This doesn't work because the script calls to clone into the players GUI backpack, so I would have to call to there but no idea how. Q.Q TheAsianGamerHD 5 — 10y
0
Interesting. You'd probably have to ask someone less Novice then I. Clubb12 0 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

I'm not quite sure about this, but I'm almost sure this would work if not be close to the right idea.

Put a localscript inside the frame and set this as the script

wait(3) --causes the script to wait 3 seconds before starting the fading
frame = script.Parent

for i = 1, 50 do
    wait(1/20)
    frame.TextTransparency = frame.TextTransparency + .02
end

This would cause the text to fade away over a period of 2.5 seconds after being visible for 3 seconds. To speed it up, set the wait to wait() or from 1/30-1/21, to slow it down set the wait anywhere from 1/19-1(I recommend you don't slow it down, otherwise it will take a very long time to disappear).

Log in to vote
0
Answered by
TheMyrco 375 Moderation Voter
10 years ago

Clubb was close, but the property is TextTransparency. Check this link.

If you want a fading effect, use a for loop, like so:

for x = 0, 1, 0.05 do
    «GUI».TextTransparency = x
    wait(0.04)
end

Answer this question