Ive had the problem for a while where the player would join the game before Server Scripts have time to load, causing all kinds of problems when using PlayerAdded
events. This happens because I use one script to import all the necessary scripts into the server when it starts up. Thankfully this is only a roblox studio problem so it doesn’t occur ingame. But are there any ways to stop this problem in studio?
First and foremost I would disable CharacterAutoLoads.
You will now need to spawn people in by using :LoadCharacter() for existing players after the server is ready, when new players join, and when they die.
Secondly, come up with a good way to tell when the Server has finished all of its loading processes.
At that point, you’ll iterate through all the players who have since joined the game, run :LoadCharacter() on them. The wiki page for CharacterAutoLoads actually has a fantastic code example for this.
I might have misunderstood your question.
If you are not concerned about the character loading (I just know this can be messy if the server is not ready to apply custom cosmetics), but rather you want to hold off on running local code, you could do that in a few ways.
One way would be to create a BoolValue and put it in a shared location like ReplicatedStorage. Clients must poll that value and wait until it’s set to True by the server after a successful startup, before they run any code.
Don’t forget about IsLoaded and DataModel | Roblox Creator Documentation, they could help here.
I probably should’ve been clearer with the explanation but this seems to be exactly what I needed so thank you.