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

How do I wait until another person join then game starts?

Asked by 4 years ago

I do not know how to do that so I am asking you guys

3 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

This should work, next time before posting please search online. I found it instantly. Thank you :)

1local players = game:GetService("Players")
2 
3while wait() do -- Maybe don't use wait(), but just an example (https://devforum.roblox.com/t/avoiding-wait-and-why/244015)
4    if #players:GetPlayers() > 2 then -- checks to see if there is more  than 2 players, #players returns the number of players for us :)
5        print(“Enough players! Starting”)
6    else
7        print(“Not enough players =(”)
8    end
9end
0
i recommend using repeat and until mroaan 95 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
1game.Players.PlayerAdded:Connect(function()
2stuff
3end)
Log in to vote
0
Answered by
mroaan 95
4 years ago
Edited 4 years ago

this should work:

1repeat wait() until #game.Players:GetPlayers() >= 2
0
what it will do it will keep waiting until there's enough players mroaan 95 — 4y

Answer this question