Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Wait for players to teleport and load?

Asked by 3 years ago

I am making a horror game that can be singleplayer or multiplayer. However, I want to play a cutscene for all players after they all join and load into the server. How would I go about waiting for players?

0
I only know how to do 1 player but not multiple MarcTheRubixQb 153 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

I am pretty sure you would just loop through all the players and see if they have a character, which would mean they are loaded, I am pretty sure something like this should work.

local Players = game:GetService("Players)

for _, player in pairs(Players:GetChildren()) do -- Loops through all the players 
    repeat wait() until player.Character -- Sees if they have a character if not then repeat again to see if they have it.
end

-- Code here after all players characters are there or if they are all loaded in
Ad

Answer this question