I made some code that's supposed to get the number of players in the game and determine what level of the game the players will be in by that number. Its parent is a textlabel, so the text is supposed to change judging by the number of players as well. For some reason, it doesn't do anything at all. There's no errors in the console, just nothing happens at all. I put in some prints to see where it stops working, and it only gets as far as 1. Is there something I'm doing blatantly wrong? Sorry if this is stupid
local text = script.Parent.Text
local gameStage = nil --gamestage is which level of the arena they're on. if players = 20-9, 1. 8-5, 2. 4-2, 3.
local timer = nil
print("1")
function StartGame(players)
print(players)
timer = 10
repeat
text = timer
wait(1)
timer = timer - 1
until timer <= 0
end
game.Players.PlayerAdded:Connect(function()
print("2")
for num,v in pairs(game.Players:GetChildren()) do
print("3")
if num < 2 then
text = "Waiting for players"
print("4")
elseif (num >= 2 and num <= 4) then --players 2-4
gameStage = 3
StartGame(num)
print("4")
elseif (num >= 5 and num <= 8) then --players 5-8
gameStage = 2
StartGame(num)
print("4")
elseif (num >= 17 and num <= 20) then --players 9-20
gameStage = 1
StartGame(num)
print("4")
end
end
end)
