Best way to get a broadcast from server to wait for the client-side script to load (for playerJoined events)?

I have a script that spawns some templates to client-side once a player joins the game (players are assigned their own lots and my kitbashed models are too complex to load them in for every single player). I am using BroadcastToPlayer on the server side to tell the client script to load in those props to the player's assigned lot once they join the game.

Everything works great, except the client script is loading in too slow to receive the broadcast at the time the game starts up. I can fix this by adding Task.Wait(5) before the broadcast so that the client script has time to load up first. I was mostly just using this for troubleshooting to make sure it actually works.

My question is - is there a better way to get my server script to wait for the client script before sending the broadcast to it? Picking an arbitrary amount of time to wait seems unreliable since I can't predict how long it will take for each client to load the script. Both scripts are in the hierarchy, if that matters.

A common pattern is to broadcast from the client script to the server to tell the server that the client / player is ready.

  • Client script broadcasts to server.
  • Server listens for the event.
  • Server then broadcasts back to the client.

Hello again CommanderFoo!

Actually I think that will work out perfectly if I can get my listener function from the playerJoinedEvent to keep checking if the client is connected yet before finally broadcasting to it.

Thank you for your help!!