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

PlayerAdded script wont work?

Asked by 9 years ago

For a gui that i am trying to make, I try to do this:

Welcome = script.Parent.Welcome --Welcome is a TextLabel welcoming you to the game (Transparency is at 1)

game.Players.PlayerAdded:connect(function()
for i = 1,10 do
    wait(0.1)
    Welcome.TextTransparency = Welcome.TextTransparency - 0.1
    end
end)

If i made a mistake I didnt copy and paste.

1 answer

Log in to vote
0
Answered by 9 years ago

Note: "PlayerAdded" doesn't work for LocalScripts; use "ChildAdded" instead. You really shouldn't use PlayerAdded to listen for when the player has been added because by the time the script runs, the PlayerAdded event will probably have been fired, meaning that your event will only execute when a different player enters the game.

Try this instead:

Welcome = script.Parent.Welcome
function FadeInIntro()
    for i = 1, 10 do
            wait(0.1)
            Welcome.TextTransparency = Welcome.TextTransparency - 0.1
    end
end
if game.IsLoaded then
    FadeInIntro()
else
    game.Loaded:connect(function()
        game.ReplicatedFirst:RemoveDefaultLoadingScreen()
        FadeInIntro()
    end
end)
0
Thanks! InvisAssassin 5 — 9y
Ad

Answer this question