I've asked questions about the same script, but this is a different section. Previously a kind samaritan helped me find a random player and have the ability to change values in the player, but I cannot detect if the player left the game so I can wrap up the game.
-- This selects the player "p[selected_value]"
local plrs = game:GetService("Players")
local p = plrs:GetPlayers()
local selected_value = math.random(1,#p)
p[selected_value].Settings.Tagger.Value = true
I tried checking if the player is nill, but that had no outcome
local waiting = 30 -- amount of time to count down from
for y = 1,waiting + 1 do -- this makes it stop at 1
wait(1)
if p[selected_value].Settings.Tagger.Value == true then -- checks if he is tagger, if not he has died.
main.MainText("Time remaining: "..waiting) -- calls a module script to change GUI
waiting = waiting-1 -- decreases amount of time left
elseif if p[selected_value] == nil then -- checks if the 'tagger' left
main.MainText("The Player has left.") -- calls a module script to change GUI
wait(2)
break -- breaks the loop, thus ending the game.
end

5 comments
How would I detect it in this script :/
I don't know what you are trying to accomplish so If you give that I can thoroughly help
Im running a count down, and every second it checks if the player has died and if so, it breaks to loop to end the game
You could set a boolean value like taggerLeft = false, then when the event fires you could say taggerLeft = true, and then your code could check the true/false on each loop cycle to branch to other logic.
I didn't think of that, Thanks!