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

PlayerAdded function in a ScreenGui, not working?

So, the script has a ScreenGui, followed by a Frame, and inside is the TextLabel. Inside of the TextLabel I put the following script, and it will not do anything whatsoever. I'm not sure what went wrong, I've tried all I could. =/

intro = script.Parent
game.Players.PlayerAdded:connect(function()
	intro.Parent.Visible = true 
	wait(1) 
	intro.Text = "Loading..."
	wait(3)
	intro.Text = "Loading...."
	wait(5) 
	intro.Text = "Welcome to Quest for Adventure." 
	wait(2) 
	intro.Text = "" 
	intro.Parent.BackgroundColor3 = UDim2.new(0,0,0) 
	
end)

Thanks.

2 comments

0

I think PlayerAdded only works in server scripts. Plus, the ScreenGui has to be the ancestor of the TextLabel and Frame.

0

It is the ancestor. Also, I've tried to play in-game, and it doesn't work there either. Not quite sure what's wrong.

1 answer

✓ Accepted answer

PlayerAdded Does not work inside a PlayerGui Remove the function and do it on it's own.

PlayerAdded Event should be in workspace, not in a Player's Gui,Backpack or Anything else, since it works on every time a player joins like this.

game.Players.PlayerAdded:connect(function(plr) -- Put this script in workspace

print("Player Has Entered Server")  -- Every time a player's entered this prints.
-- Also watch what I do below
plr:WaitForDataReady("StarterGui").ScreenGui.Frame.TextLabel.Text = "See Changed it" -- you can change the text through a script in workspace too!
end)

Now to fix your script, Because you under stand PlayerAdded Event a bit better.

intro = script.Parent
wait(3)-- Let the character load a bit.
    intro.Parent.Visible = true 
    wait(1) 
    intro.Text = "Loading..."
    wait(3)
    intro.Text = "Loading...."
    wait(5) 
    intro.Text = "Welcome to Quest for Adventure." 
    wait(2) 
    intro.Text = "" 
    intro.Parent.BackgroundColor3 = Color3.new (0,0,0) -- Not UDim2.

UDim2 is used for resizing and changing position of a GUI.

This should work, though you can change this through a script in workspace, but since I don't have the info this should work.

If I helped +1, if I answered question check mark :)

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