Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

PlayerAdded script wont work?

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

✓ Accepted answer

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)

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.