Why does the PlayerAdded event not work in two separate scripts?

I have been testing things and after testing several times, I could see that only one PlayerAdded event fires while the other does not. I even tested on a separate place to see if it was still the same. Once I tested on the other place it did work, both events fired but on the other one I am currently programming on it did not.

Here is a screenshot of the place in which I am programming now

image

image

In the other script I have the event PlayerAdded

image

In the output
image

This even happened with the PlayerRemoving event. I don’t know what happened in these scripts.

The script that shows a print("Testing") is the script where the DataStore resides and the other one is the round handler in the game, the one that doesn’t work is the PlayerAdded event of the round handler. I don’t know what to do :’(

Apparently PlayerAdded doesn’t run in a LocalScript. There’s an explanation here. The solution is to just run whatever you need to run in your LocalScript instead of worrying about the PlayerAdded part. If you’re trying to make the LocalScript run everytime a player is added, it won’t work because a LocalScript loads with a player and a player can load after other players load in, meaning the LocalScript won’t run for every player before the local player.
So, IF YOUR LOCALSCRIPT IS JUST TRYING TO RUN WHEN THE LOCALPLAYER IS ADDED then remove the “PlayerAdded” part and just run your LocalScript without it. IF YOUR LOCALSCRIPT IS RUNNING FOR EVERY PLAYER ADDED then move the logic to a Script, because it can’t work in a LocalScript.
By the way, two different Scripts can both have PlayerAdded events at once.

In fact the PlayerAdded events are just placed in a separate server script. One handles the saving of player data and the other handles the rounds that will appear in the game.

The only thing I can think that would cause this behavior is if the connection code never runs. You could try placing a print statement directly before the connect statement to ensure that the code is actually getting there.