I'm trying to make a round system and I need to know when one player is in the game so I can end it but I don't know how to check if only one player is in the game, But what I know is that I made a folder inside every player called PlayerValues and inside it there's a boolvalue that is called InGame.
THIS IS NOT A REQUEST, DO NOT FLAG THIS QUESTION.
I would really appreciate if you will help me, Plus I'll accept your question if it worked.
Thanks, MajinBluee
Use this:
function playersAlive() local amount = 0 for _,v in pairs(game.Players:GetPlayers()) do if v.PlayerValues and v.PlayerValues.InGame and v.PlayerValues.InGame.Value then amount = amount + 1 end end return amount end -- Check if one player is alive if playersAlive() <= 1 then print('Game over') end