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

How do I make it so I can count every two players added?

Asked by 4 years ago
Edited 4 years ago

I want to make it so when 2 players join a game, it will do something, then wait for another 2 players and also do something.

1 answer

Log in to vote
4
Answered by
Elyzzia 1294 Moderation Voter
4 years ago

you can use a while loop and the PlayerAdded event to do this

local Players = game:GetService("Players")

while true do
    for i = 1, 2 do
        Players.PlayerAdded:Wait() -- you can call :Wait() on an event to wait for it to fire
    end
    -- do something here
end
0
Nevermind it only did it once and not again Builderjava 5 — 4y
Ad

Answer this question