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

Why the PlayerAdded event wont execute?

Asked by
Xianon 105
10 years ago
game.Players.PlayerAdded:connect(function(player) -- Output won't tell what's the problem --
    print("Active")
    script.Parent.Text = (game.Players.NumPlayers)
end)

3 answers

Log in to vote
0
Answered by 10 years ago

Odd.

Try printing before the function, and then use

print("Searching Players")
game:GetService("Players").PlayerAdded:connect(function (player)
print(player.Name.." found")
end) 

Also, PlayerAdded does execute in Test Solo.

0
Odd, It prints (Searching Players) but after the event nothing happens... Xianon 105 — 10y
0
It works on my test solo. Perhaps it has something to do with your Players service properties, or even your Studio version and configuration. Drak0Master 172 — 10y
0
I used it without PlayerAdded and it worked, Roblox changed it! :0 Xianon 105 — 10y
0
Erm, what? Without PlayerAdded? Can you comment the exact line, please? Drak0Master 172 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

I'm not sure on the specific details of this, but I know for a fact that when in studio, and you do a test run with a player, it's not going to read your player entering. It will only work if you are joining a server. How I like to test games sometimes is by minimizing studio, opening ROBLOX, and then going into my game. Don't forget to "Upload to ROBLOX as" and then every time you update it, to "Update to ROBLOX".

I read something about this error on the wiki, but don't take my word for it: I read a lot of wiki pages and often mix of the info, but hey - it's worth a shot.

0
Thanks, but i'm joining in sever not in Solo Mode. Xianon 105 — 10y
0
Sorry then, I'm not sure what to say. killercrock0 0 — 10y
Log in to vote
0
Answered by 10 years ago

Ive had problems with playeradded in the past.

A little workaround that should work:

game.Players.ChildAdded:connect(function(child)
    print("Active")
    script.Parent.Text = (game.Players.NumPlayers)
end)

Answer this question