I am trying to make it so that every time it changes the value of 'main text', it checks if a specific player (the tagger) has died, and if so, it ends the loop thus ending the game without the rest of the countdown.
plrs = game.Players
p = plrs:GetChildren()
for i = 1,#p do
b = math.random(1,i)
for i,v in pairs (game.Players:GetPlayers()) do
v.Settings.Playing.Value = true
end
p[b].Settings.Tagger.Value = true
local waiting = 30
for y = 1,waiting + 1 do
wait(1)
if p[b].Settings.Tagger.Value == true then
main.MainText("Time remaining: "..waiting) -- changes a value through a module script
waiting = waiting-1
elseif p[b].Settings.Tagger.Value ~= true then
main.MainText("Tagger has died") -- changes a value through a module script
wait(1)
y = 1,0
end
end
end

2 comments
To end a loop you would use "break".
Thanks! this is way for simple than I though