My game script creates teams deletes the lobby team and puts the players on the teams but the problem is it doesn't teleport them to the teleportationparts in the map Please read to the end even tho this looks like alot.
local players = game.Players:GetPlayers()
local timeleft = Workspace:findFirstChild('timeleft')
local currentMap = game.Workspace.currentMap
local _Teams = game:GetService'Teams'
local _Players = game:GetService'Players'
function removeTime()
for i = 120, 0, -1 do
wait(1)
timeleft.Value = i
end
end
function gameStart()
local players = game.Players:GetPlayers()
for i = 1, #players do
local stats = players[i].PlayerGui.fullGui.everything.gamePlay.informer
stats.Text = 'New round beginning!'
stats.FontSize = 'Size24'
timeleft.Value = 120
wait(1)
stats.Text = ''
end
end
local function splitplayers()
game.Teams.Lobby:Destroy()
local UseSecondTeam = false
for i, v in ipairs(_Players:GetChildren()) do
if UseSecondTeam then
v.TeamColor =
_Teams["Cops"].TeamColor
else
v.TeamColor =
_Teams["Crimanals"].TeamColor
end
UseSecondTeam = not UseSecondTeam
end
end
function pickteams()
local Cops = Instance.new("Team", game.Teams)
Cops.TeamColor = BrickColor.new("Bright blue") -- Note that TeamColor is a BrickColor value
Cops.Name = "Cops"
Cops.AutoAssignable = false
local Crimanals = Instance.new("Team", game.Teams)
Crimanals.TeamColor = BrickColor.new("Bright orange")
Crimanals.Name = "Crimanals"
Crimanals.AutoAssignable = false
end
function teleportPlayers()
local players = game.Players:GetPlayers()
local copspawn = workspace.teleportationpart
if players.TeamColor == BrickColor("Bright blue") then
players.Character.Torso.CFrame = CFrame.new(copspawn.Position)
end
local robberspawn = workspace.teleportationpart2
if players.TeamColor == BrickColor("Bright orange") then
players.Character.Torso.CFrame = CFrame.new(robberspawn.Position)
end
end
function waitSome()
local players = game.Players:GetPlayers()
for i = 1, #players do
local stats = players[i].PlayerGui.fullGui.everything.gamePlay.informer
stats.FontSize = 'Size24'
stats.Text = "Intermission! Check our the shop and talk to your friends!"
wait(30)
stats.Text = ''
end
end
function endGame()
local players = game.Players:GetPlayers()
for i = 1, #players do
players[i]:LoadCharacter()
end
end
currentMap:ClearAllChildren()
function goAhead()
local players = game.Players:GetPlayers()
for i = 1, #players do
players[i].PlayerGui.fullGui.everything.gamePlay.informer.Text = 'We have enough players to start!'
end
end
function chooseMap()
local maps = game.ServerStorage.Maps
local clone = maps[math.random(1,#maps)]
clone.Parent = currentMap
end
while wait() do
if game.Players.NumPlayers >= 2 then
goAhead()
pickteams()
splitplayers()
chooseMap()
gameStart()
teleportPlayers()
if game.Workspace.NoCash == true then
game.Workspace.timeleft = 0
removeTime()
endGame()
waitSome()
else
local players = game.Players:GetPlayers()
for i = 1, #players do
players[i].PlayerGui.fullGui.everything.gamePlay.informer.Text = '2 players are needed to start! Invite a friend.'
end
end
end
end
I think the problem is in the teleportplayers function but im not sure. It could in the end part where it calls all the functions. I know this looks lke a lot but its probly a simple fix.

3 comments
Thank you so much! I tried fix it for so long! All I knew was it wasn't teleporting the players! Thank you so much! I'll put your name in the script with mine to give credit. I wouldn't have been able to make it without you. I wish I could click the plus arrow to give you more rep but my rep is too low. Thanks a billion you just made my day!
Sure thing!
You can hit accept answer! That will give us both +1 reputation!