I’m trying to create a list of players still playing based on a boolean value that I have saved inside the player. With my current code no players are being put into the list. I’ve looked around for a solution but I couldn’t find anything.
Code:
game.Players.PlayerAdded:Connect(function(player)
local values = Instance.new("Folder", player)
values.Name = "values"
local playerPlaying = Instance.new('BoolValue', player)
playerPlaying.Name = "playing"
playerPlaying.Parent = player.values
player.CharacterAdded:Connect(function(Char)
Char.Humanoid.Died:Connect(function()
playerPlaying.Value = false
end)
end)
end)
local playersPlaying = {}
for i, player in pairs(game.Players:GetChildren()) do
if player.values.playing == true then
table.insert(playersPlaying, player.Name)
end
if #playersPlaying <= 1 then
gameTime = 1
end
end