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

I'm trying to make text appear on the screen and dissapear, it isn't working, any ideas?

Asked by 4 years ago

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)`
0
May I know whether it is a Local script or a normal script, also where the script is located. And where's you text label is located BestCreativeBoy 1395 — 4y
0
"if Players.PlayerAdded then" what does this do? rabbi99 714 — 4y

2 answers

Log in to vote
0
Answered by
imKirda 4491 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

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.

Ad
Log in to vote
0
Answered by
MediaHQ 53
4 years ago

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

Answer this question