I have this round script you vote for a map and then play, but for some reason, the table will only add one player to it.
local cachedSpawns = {}
local playersPlaying = game.Players:GetPlayers()
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
-----------------------------------------------------------------------
map:Destroy()
for a,b in pairs(playersPlaying) do
--Teleport back
local char = b.Character or b.CharacterAdded:wait()
local HubSpawns = game.Workspace.HubSpawns
local randomSpawns = HubSpawns:GetChildren()[Random.new():NextInteger(1,#HubSpawns:GetChildren())]
char.HumanoidRootPart.CFrame = (randomSpawns.CFrame * CFrame.new(0,2.25,0))
table.remove(playersPlaying)
inGame = false
en
end
wait()
end
--Code
Any help will be appreciated. Edit: I changed the code above to the actual code

2 comments
local playersPlaying = game.Players:GetPlayers(), simply use that, otherwise it would only do so if there was only one Player in-game.
Still only one person gets added to the table?