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 3 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 3 years ago
Edited 3 years ago

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

local players = game:GetService("Players")

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

this should work:

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

Answer this question