So the script is supposed to detect how many players are on a team and if the amount of players on a team changes or not. So if there wasn't enough people on each time (the minimum is 1 player), it would print a message. But if the teams suddenly got enough players, it would begin the game, and vice versa.
The script worked before, and now it's not working, and I have no idea why. Everything is defined. Can someone please help me?
Here's the script:
local Ready = script:WaitForChild("Ready") local team = game.Teams; function getPlayers(teamColor) -- team color is easier than name local found = { }; for _,v in pairs(game.Players:GetPlayers()) do if v.TeamColor == teamColor then table.insert(found, v) end end return #found end while wait() do print('Starting game') wait(5) while wait() do local greenNum = getPlayers(BrickColor.new('Bright green')) local redNum = getPlayers(BrickColor.new('Bright red')) if Ready.Value == false then if greenNum > 0 and redNum > 0 then Ready.Value = true else print('Nope') end end end if Ready.Value == true then print('Starting game...') end end