Is there any way to detect when players are finished loading?

Hey Roblox devs. I have a question; is there any way a script can detect when players are done loading in? For example, I have a place in my game where players teleport to. This place has a maximum capacity of 4 players, since it’s a campaign game. The thing is, when people are playing with other people some players might load in faster than others, and this is not good for my scripts. Right now I just have a universal clock for 3 seconds, so as soon as 1 player joins in it gives all the other scripts time to wait for more players to join.

I feel like there’s a more efficient way to approach this, but I don’t know. Should I stick with the server waiting for more players to join in or is there any beter alternative?

3 Likes

since the player object is added in on the player joining (from what I know), you can count how many players there are, and then wait until the workspace has a+b amount of children (a being the original size of the workspace, b being the player count)

might not work tho

I already have a system detecting how many players are in the game. The thing I want to do is have a script that knows a player is loading into it, and is not yet in the game. So let’s say there’s 2 players actually in the game and there’s still 1 player loading in. I want to know if there’s anything that will detect that that one player is loading, and that it should wait until that player is joined.

I would say either a waitforchild or a “check how many child instances is in workspace”

if game:IsLoaded() == false then game.Loaded:Wait() end

Another way to write this:

if not game:IsLoaded() then game.Loaded:Wait() end

[Needs to run from a local script].
This would wait until any Data Model [ including the Player] is fully loaded.

3 Likes

This is exactly what I need, thanks

1 Like