PlayerAdded:Connect( ) does not FIRE

hello, this code does not fire when I click PLAY on roblox studio.
my (LOCAL) script is under StarterPlayer.StarterCharacterScripts or StarterPlayer.StarterPlayerScripts ; a following snippet:

local ___OOF = game:GetService("Players"); 

___OOF.PlayerAdded:Connect( function (player) 
    print(player); 
end)

also, I have another issues! I can access game:GetService(“Players”).LocalPlayer but using WaitForChild(“Humanoid”) has infinite yield !!!

I decided to iterate and found that this local player is actually under Players which has backpack, playerscripts, etc, but no Humanoid.

I tried the examples in the link below but it does not fire? Anyone know a solution to this or experience this problem? Please HMU.

that is because the player added is firing before this script is running.

It’s supposed to be “PlayerAdded,” not “PlayersAdded.” That’s why it’s not working.

local ___OOF = game:GetService("Players"); 

___OOF.PlayerAdded:Connect( function (player) 
	print(player); 
end)

yer sorry typo… i have it correctly on the script (local)

i found an alternative solution; not the solution so ill keep the post open… thanks folks.

--[[ starter player scripts / local script ]]
function __OOF ( )
     local character = game:GetService("Players").LocalPlayer.Character;
end

oofRemoteEvent. OnClientEvent:Connect(__OOF);

…Why do you even need PlayerAdded events in the first place?

If the LocalScript is in StarterCharacterScripts or StarterPlayerScripts, the script will be parented to the player (StarterPlayerScripts) or the Character (StarterCharacterScripts). There is no need to use PlayerAdded IMO.
Of course, the event doesn’t fire because the player is ALREADY in the game when this script is running, meaning it will probably never fire. Just use game:GetService("Players").LocalPlayer to adress the player, seeing LocalScripts run on the client.

As for the infinite yield, the humanoid is in the player’s Character, so maybe try adressing it there.
(although you should use CharacterAdded events in order to get the character, seeing as it can die)

Hope I helped!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.