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

How do you use loops correctly to check players on a team?

Asked by 8 years ago

Basically, I want this script to constantly check the count of the blue team's players until it's 0and then I want to execute a script.

I don't know how to loop it..

if #game.Teams.Runner:GetPlayers() == 0 then
--do stuff
end

1 answer

Log in to vote
0
Answered by
yyyyyy09 246 Moderation Voter
8 years ago
Edited 8 years ago

In this case you would use a While loop which is basically an if statement, but While something is equal to something or true, it will play the loop until it's not equal or false

in this case you can do

while #game.Teams.Runner:GetPlayers() > 0 do
    -- Whatever you want in here
end

The wiki has some information on the types of loops and how they work here http://wiki.roblox.com/?title=Loops

Ad

Answer this question