I recently made a basic timed round system for a game I am working on for me and a few friends and my only problem is after the round starts the map spawns but doesn't teleport because I have tried to make the basic teleport script found on the wiki to also manage teams. Also the script needs to assign players to a team before getting teleported to the map.
ROBLOX's Script from the wiki.
local oldMessage = ""
local minPlayers = 2
function teleportAllPlayers()
local target = CFrame.new(workspace.TeleportTarget.Position)
for i, player in ipairs(game.Players:GetChildren()) do
player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
player.Playing.Value = 1
--add an offset of 5 for each character
end
end
function message(message)
if oldMessage ~= message then
oldMessage = message
print(message)
end
end
function playersCurrentlyPlaying()
for i, player in ipairs(game.Players:GetChildren()) do
if player.Playing.Value == 1 then return true end
end
return false
end
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
player.Playing.Value = 0
end)
end)
local playing = Instance.new("IntValue", player)
playing.Value = 0
playing.Name = "Playing"
end)
while(true) do
wait(10)
if #game.Players:getPlayers() >= minPlayers then
if playersCurrentlyPlaying() then
message("Waiting for the current game to end...")
else
message("There are enough players for a new game! Teleporting...")
wait(4)
teleportAllPlayers()
end
else message("Waiting for more players...") end
end
Thanks for the help! AGNight

2 comments
for one thing, you do not need CFrame.new(game.workspace.Teleport.Target.Position) because it can simply be written without the CFrame.new.... For another thing that message function only prints in the console, and that conditional in the while true loop does not even check that the user is playing, and the first if statement inside the while loop is not even a statementt, use if(game.Players.nu
Where was the question? I can't find it. I think you might have made a request so I'll just let you know. This is NOT a request site. We help, we will not do it for you.