For some reason, the table only adds one player out of the 16 players, I'm really unsure what to do now
local playersPlaying = {}
for i,player in pairs(game.Players:GetPlayers()) do
local char = player.Character or player.CharacterAdded:wait()
if char then
local randomSpawns = map.Spawns:GetChildren()[Random.new():NextInteger(1,#map.Spawns:GetChildren())]
if cachedSpawns[randomSpawns] then
repeat randomSpawns = map.Spawns:GetChildren()[Random.new():NextInteger(1,#map.Spawns:GetChildren())] wait() until not cachedSpawns[randomSpawns]
end
table.insert(playersPlaying,player.UserId)
print(playersPlaying)
cachedSpawns[randomSpawns] = true
for a,b in pairs(playersPlaying) do
char.HumanoidRootPart.CFrame = (randomSpawns.CFrame * CFrame.new(0,2.25,0))
end
local inGame = false
local status = Game.Stats.Status
local gameTime = Settings.gameTimeLimit
while wait() do
inGame = true
repeat
gameTime = gameTime - 1
status.Value = gameTime.." "..((gameTime == 1 and "Second") or "Seconds").." left."
wait(1)
until gameTime == 0
break
end
--[[local plrs = game.Players
local murderer = plrs:GetChildren()[math.random(1,#plrs:GetChildren())]
print(murderer)]]--
end
end
Any help is appreciated.

2 comments
Im not too sure, but could it possibly because its only firing once then loops? Idk. Maybe add a coroutine
I've tried coroutines but still only adds a single player to the table