So I'm writing a script to start the round to a game when a child is added to the "PlayerObjects" folder. An object is added to the PlayerObjects folder when a player joins - there is a server script which will create the related folder & objects and will then place it into the PlayerObjects folder.
What I am worried about is this: If two players join at the same time and two objects are created in the PlayerObjects folder, will they be created simultaneously? Is there any possibility that the server script listening to ChildAdded will begin running for one object, and before it is finished it will spin off another thread for the second child added?
This is logic that might break the game, so I am adding checks by creating a boolean value as a child of the script that it checks to see if the script itself is already running. I don't know if I'm overdoing it or not - does anybody know if this is a reasonable concern?
when you connect to an event it automatically creates a new thread every single time the event is fired, they will not overlap each other and stop in case 2 players join at the same time unless they use the same upvalues or such.