I've been making an Afk button in my round based PVP game, but if there are 2 players when a round starts and one is afk, the other player will automatically win and get points. The afk option works fine. So, my question is, how can I make the game check to see if there are at least 2 people who aren't Afk?
(There are 2 values, "NotPlaying" and "Playing")
Here is the script:
while true do
Status.Value = "Waiting for enough players"
repeat wait(1) until game.Players.NumPlayers >= 2
Status.Value = "Intermission"
wait(20)
local AvailableMaps = MapsFolder:GetChildren()
local ChosenMap = AvailableMaps[math.random(1,#AvailableMaps)]
local ClonedMap = ChosenMap:Clone()
ClonedMap.Parent = workspace
Status.Value = "Picking a map..."
local plrs = {}
for i, player in pairs(game.Players:GetPlayers()) do
if player:FindFirstChild("Playing") and player then
table.insert(plrs,player)
end
end
wait(2)
(This is only the part of the script where it adds the players)

1 comment
Optionally, you could do a check in other scripts for 'player:FindFirstChild("AFK Timer").Value'. (When it is equal to 0, the player would be considered afk)