The Problem
Hi there! I’m making a round system, the problem is that only one player gets teleported and all of the other players not.
Here is my script:
local players = {}
local spawnPoints = clonedTiles:FindFirstChild("SpawnPoints"):GetChildren()
for i, player in ipairs(game.Players:GetChildren()) do
if player then
table.insert(players, player)
if player.Character then
local character = player.Character
local randomSpawnPoint = spawnPoints[math.random(1, #spawnPoints)]
character:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(randomSpawnPoint.Position) + Vector3.new(0, 5, 0)
end
elseif not player then
table.remove(players, i)
end
When copying and pasting the layout went wrong, sorry for that.
I discovered that the players does get added to the table, but they don’t teleport.
I hope you do know how to fix this, thanks for reading!