Ad
Log in to vote
0

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

Asked by 25 days ago

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

3 answers

Log in to vote
0
Answered by 25 days ago
Edited 25 days 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 — 25d
Ad
Log in to vote
0
Answered by 25 days ago
game.Players.PlayerAdded:Connect(function()
stuff
end)
Log in to vote
0
Answered by
mroaan 95
25 days ago
Edited 25 days 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 — 25d

Answer this question