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

Why does the PlayerAdded Event not firing even if im playing in server?

Asked by 10 years ago

I don't know why it doesn't work

game.Players.PlayerAdded:connect(function(player)
    Intro = script.Intro:Clone()
    Intro.Screen.Frame.System.Disabled = false
    Intro.Parent = player.PlayerGui
end)

2 answers

Log in to vote
1
Answered by 10 years ago

If your pathways are all correct (which only you can make sure of) then this should work fine:

game:GetService("Players").ChildAdded:connect(function(Player)
if Player:IsA("Player") then
repeat wait(1/30) until Player:findFirstChild("PlayerGui") and Player.Character ~= nil
Intro = script.Intro
Intro.Archivable = true
NewIntro = Intro:Clone()
NewIntro.Screen.Frame.System.Disabled = false
NewIntro.Parent = Player.PlayerGui
end
end)

If your script is server sided then you can change ChildAdded to PlayerAdded and (optionally) you can remove the if Player:IsA("Player") then and the corresponding end.

0
It might be worth mentioning that PlayerAdded doesn't work in a LocalScript, you have to use the ChildAdded event instead. duckwit 1404 — 10y
0
That will error if Player.PlayerGui doesn't exist yet. Merely 2122 — 10y
0
Edited. Archonious2 160 — 10y
Ad
Log in to vote
0
Answered by 10 years ago
game.Players.PlayerAdded:connect(function(p)
    --stuff
end)

Would work in a server script, or a workspace script, but not local, which I think is what you're trying to do.

I would try

game.Players.ChildAdded:connect
0
It runs on the workspace script so... RobloxMinecraftDK 0 — 10y

Answer this question