function TeleportPlayers()
for Index, Plr in pairs(players:GetChildren()) do
if Plr.Character or Plr.CharacterAdded:Wait(2) then
Plr.Character.HumanoidRootPart.CFrame = teleports[1].CFrame
end
end
end
Just fire this function and it should teleport the players
The “Wait()” instance method of events does not receive any parameters, so in this case passing a number value of “2” to it is redundant.
local Players = game:GetService("Players")
for _, Player in ipairs(Players:GetPlayers()) do
local Character = Player.Character or Player:GetPropertyChangedSignal("Character"):Wait()
Character:PivotTo(teleports[1].CFrame)
end
end
for _, Player in ipairs(game.Players:GetPlayers()) do
local Char = Player.Character or Player.CharacterAdded:Wait()
Char.HumanoidRootPart.CFrame = teleports[1].CFrame
print(Player.Name)
end