Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

3 answers

✓ Accepted answer

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

1 comment

0

i recommend using repeat and until

game.Players.PlayerAdded:Connect(function()
stuff
end)

this should work:

repeat wait() until #game.Players:GetPlayers() >= 2

1 comment

0

what it will do it will keep waiting until there's enough players

This discussion is preserved as it was. New answers, comments, and votes are closed.