For one of my games I'm trying to make text appear then disappear after around 6/7 seconds The code doesn't seem to be working (probably because I don't have much coding knowledge)
Any ideas?
code:
`local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) player:LoadCharacter() if Players.PlayerAdded then script.Parent.TextLabel.TextTransparency = 1 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.9 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.8 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.7 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.6 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.5 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.4 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.3 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.2 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.1 wait(0.001) script.Parent.TextLabel.TextTransparency = 0 wait(5) script.Parent.TextLabel.TextTransparency = 0.1 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.2 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.3 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.4 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.5 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.6 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.7 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.8 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.9 wait(0.001) script.Parent.TextLabel.TextTransparency = 1 wait(0.001) end end)`
What in the world is
if Players.PlayerAdded then
You don't have to have that line there, if you want to check if the player exists then do it like this:
if player then
Also instead of this big mess changing the transparency you should use for loops. So in your case:
for transparency = 1, 0, -0.1 do script.Parent.TextLabel.TextTransparency = transparency wait(0.001) end
Also by using wait(0.001) i don't know if you modified the studio settings but if you haven't then the lowest value that can be put into wait is by default 0.03
so if i'm sure using 0.001 is same as using 0 or 0.02 or any number lower than the default.
You can put the code in a Localscript instead of a script
wait(5) --Replace the value with how long it takes to load into game script.Parent.TextLabel.TextTransparency = 1 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.9 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.8 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.7 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.6 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.5 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.4 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.3 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.2 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.1 wait(0.001) script.Parent.TextLabel.TextTransparency = 0 wait(5) script.Parent.TextLabel.TextTransparency = 0.1 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.2 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.3 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.4 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.5 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.6 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.7 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.8 wait(0.001) script.Parent.TextLabel.TextTransparency = 0.9 wait(0.001) script.Parent.TextLabel.TextTransparency = 1 wait(0.001)
I am too kind of new to scripting so I am not sure if this would work Maybe even make a variable for the textlabel