The game waits 15 seconds and goes through all players to see if they have a value (Playing) marked as true. It stores the amount of players with the true value in a table. The problem is that sometimes the server script cannot find the value and has an infinite yield. I open explorer while i test and see "Playing" there in backpacks. I don't know why the script has an infinite yield on. Could someone help?
local GameStatus = workspace.GameStatus
wait(15)
while true do --Will continue to loop until loop isnt true anymore.
wait(1)
local ActivePlayers = 0 -- The amount of ActivePlayers is 0
local Players = game.Players:GetChildren() --Finds all children in Players. Basically finds all players.
if GameStatus.Value == "Unstarted" then --If the Game still has not started
for i = 1,#Players do --For 1, to the amount of players
print(Players[i])
-------Problem
local Playing = Players[i].Backpack:WaitForChild("Playing")
-------Problem
if Playing.Value == true then --If that player is playing
ActivePlayers = ActivePlayers + 1 --Adds 1 to ActivePlayers
end
end
if ActivePlayers >=1 then --if there's 1 or more players
print("Game will now begin!")
GameStatus.Value = "Intermission"
else --if there isnt
print("Game doesnt have enough players...")
end
end
end

2 comments
can u just store the value in the player? and the tool in the backpack has a value?
im not sure but maybe the server can't access the player backpack and u'd need to have the client send the value or just put that value in the plr