I am currently trying to make a round game, where every round the players in the game get teleported in and out, to determine who is still alive in the round, I give everyone a boolean value that gets removed when they die. However, the in pairs loop doesn't give everyone the boolean value.
Here's my script:
while true do
Status.Value = "Waiting for enough players"
repeat wait(1) until game.Players.NumPlayers >= 1
for i = 10, 1, -1 do
Status.Value = "Intermission "..i.." seconds left!"
wait(1)
end
local plrs = {}
for i, player in pairs(game.Players:GetPlayers()) do
if player then
table.insert(plrs, player)
end
end
print(unpack(plrs))
wait()
Status.Value = "Teleporting..."
for i, player in pairs(plrs) do
if player then
character = player.Character
print("test")
if character then
--Teleport
local gamepad = game.Workspace.GameParts.GamePad
character:FindFirstChild("HumanoidRootPart").CFrame = gamepad.CFrame
local GameTag = Instance.new("BoolValue")
GameTag.Name = "GameTag"
GameTag.Parent = player.Character
else
--There is no character
if not player then
table.remove(plrs, i)
end
end
end
Any ideas on why this script doesn't give all players the "GameTag" BoolValue?

2 comments
You accidentally wrote GetPlayer instead of GetPlayers
ah i'll edit it