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

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

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

✓ Accepted answer

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.

3 comments

0

It might be worth mentioning that PlayerAdded doesn't work in a LocalScript, you have to use the ChildAdded event instead.

0

That will error if Player.PlayerGui doesn't exist yet.

0

Edited.

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

1 comment

0

It runs on the workspace script so...

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