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

PlayerAdded function in a ScreenGui, not working?

Asked by
bloxxyz 274 Moderation Voter
9 years ago

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.

0
I think PlayerAdded only works in server scripts. Plus, the ScreenGui has to be the ancestor of the TextLabel and Frame. GoldenPhysics 474 — 9y
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. bloxxyz 274 — 9y

1 answer

Log in to vote
1
Answered by
HexC3D 830 Moderation Voter
9 years ago

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 standPlayerAdded 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 :)

Ad

Answer this question