repeat if script.Parent.TextTransparency == 0 then wait() end if script.Parent.TextTransparency == 1 then wait(10) script.Parent.TextTransparency = 1 wait(0.1) script.Parent.TextTransparency = 0.9 wait(0.1) script.Parent.TextTransparency = 0.8 wait(0.1) script.Parent.TextTransparency = 0.7 wait(0.1) script.Parent.TextTransparency = 0.6 wait(0.1) script.Parent.TextTransparency = 0.5 wait(0.1) script.Parent.TextTransparency = 0.4 wait(0.1) script.Parent.TextTransparency = 0.3 wait(0.1) script.Parent.TextTransparency = 0.2 wait(0.1) script.Parent.TextTransparency = 0.1 wait(0.1) script.Parent.TextTransparency = 0 end until game.Players.NumPlayers >= 2 if script.Parent.TextTransparency == 1 then wait() end if script.Parent.TextTransparency == 0 then script.Parent.TextTransparency = 0 wait(0.1) script.Parent.TextTransparency = 0.1 wait(0.1) script.Parent.TextTransparency = 0.2 wait(0.1) script.Parent.TextTransparency = 0.3 wait(0.1) script.Parent.TextTransparency = 0.4 wait(0.1) script.Parent.TextTransparency = 0.5 wait(0.1) script.Parent.TextTransparency = 0.6 wait(0.1) script.Parent.TextTransparency = 0.7 wait(0.1) script.Parent.TextTransparency = 0.8 wait(0.1) script.Parent.TextTransparency = 0.9 wait(0.1) script.Parent.TextTransparency = 1 end
i got this localscript, and it basically makes the text "waiting for players" appear for the first player that joins. when another player joins, the first player's text will fade out, and the second player SHOULDNT see the text at all. however, the 2nd player sees it fade in and out very quickly. how would i make the 2nd player not see the text at all?
Explanation
To start, if the player can see the GUI fading out, this means that you will want to speed up the time it takes to fade out the GUI. Currently, the total fade out time is a whole 1 second that can be lowered.
The Solution
To start, you will want to learn how to use for loops. They can speed up the process of what you were doing. Instead of typing out every transparency change you can just use a for loop to automate it. You can read about for loops here.
In the script given, not only did I simplify the script lots, but did I make it fade faster. See if it works.
Here is the code:
repeat if script.Parent.TextTransparency == 0 then wait() end if script.Parent.TextTransparency == 1 then wait(10) for i = 1, 0, 0.1 do script.Parent.TextTransparency = i wait() end script.Parent.TextTransparency = 0 --For good measure end until game.Players.NumPlayers >= 2 if script.Parent.TextTransparency == 1 then wait() end if script.Parent.TextTransparency == 0 then for i = 0, 1, 0.1 do script.Parent.TextTransparency = i wait() end script.Parent.TextTransparency = 1 end
If you have any other questions or comments, just reply to this answer! :)
-Crystal
The fact that there isn't a for or while loop there pains me. Crystal's solution is deprecated and a tad bit redundant, so here is probably the simplest solution to your problem.
while #Players:GetPlayers() < 3 do if script.Parent.TextTransparency == 0 for i=1,10 do script.Parent.TextTransparency = script.Parent.TextTransparency+0.1 wait(0.01) end end end for i=1,10 do script.Parent.TextTransparency = script.Parent.TextTransparency-0.1 wait(0.01) end
What this should do is if the transparency of the text is 0 and there are no more than 2 players, it will fade in the text, and when there are at least 3 players in the game, it will fade the text out at the same rate as the fade in.