Round based game: Teleportation not working

Hello Devfourm, I am making a game where there would be two teams, and each team has to kill each other in a certain time limit. If you die you have to wait for another round to start. Once all the players on a team are eliminated the other team would win. However, I am having trouble with the teleportation system. People on the British team would not teleport to the map. However, people on the union team would. There are zero error messages. Does my code work? Any help is appreciated
and yes this has @Alvin_Blox’s round based code framework

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")

local Status = ReplicatedStorage:WaitForChild("Status")
local MapsFolder = ServerStorage:WaitForChild("Maps")
local Timer = ReplicatedStorage:WaitForChild("Timer")
--Settings
local GAME_LENGTH = 50
local STARTING_PLAYERS = 2
local INTERMISSION = 10 

while true do
	Status.Value = "Waiting for More Players (two players required)" 
	repeat wait() until game.Players.NumPlayers >= STARTING_PLAYERS
	
	Status.Value = "Intermission"
	Timer.Value = INTERMISSION
	
	wait(10)
	local team1 = {} --Union Team
	local team2 = {} --Britan Team
	
	for i, player in pairs(game.Players:GetPlayers()) do
		if player then
			if player.Team == Teams["Union"] then
				table.insert(team1,player)
				print(team1)
			end
			
			if player.Team == Teams["Britan"] then
				table.insert(team2,player) 
				print(team2)
			end  
			
			
		end
	end
	
	wait(2) 
	local AvalibleMaps = MapsFolder:GetChildren()
	local ChosenMaps = AvalibleMaps[math.random(1, #AvalibleMaps)]

	Status.Value = "The Battle Of " ..ChosenMaps.Name.." Will Begin"

	local ClonedMap = ChosenMaps:Clone()
	ClonedMap.Parent = game.Workspace

	wait(4)
	
	local UnionSpawnPoints = ClonedMap:FindFirstChild("UnionSpawnPoints")
	local BritanSpawnPoints = ClonedMap:FindFirstChild("BritanSpawnPoints")

	local BritanAvalibleSpawnPoints = BritanSpawnPoints:GetChildren()
	local UnionAvalibleSpawnPoints = UnionSpawnPoints:GetChildren()
	
	for i, player in pairs(game.Players:GetPlayers()) do
		if player then
			character = player.Character
			
			if character then
				if player.Team == Teams["Union"] then
					local Gametag = Instance.new("BoolValue")
					Gametag.Name = "GameTag"
					Gametag.Parent = player.Character
					
					character:FindFirstChild("HumanoidRootPart").CFrame = UnionAvalibleSpawnPoints[1].CFrame
					table.remove(UnionAvalibleSpawnPoints,1)

					local folder = ServerStorage.UnionWeapons

					for _, object in pairs(folder:GetChildren()) do --Gets All the Weapons in the UNION folder
						newObject = object:Clone()
						newObject.Parent = player.Backpack
					end
					
				if player.Team == Teams["Britan"] then
						local Gametag = Instance.new("BoolValue")
						Gametag.Name = "GameTag"
						Gametag.Parent = player.Character

						character:FindFirstChild("HumanoidRootPart").CFrame = BritanAvalibleSpawnPoints[1].CFrame 
						table.remove(BritanAvalibleSpawnPoints, 1)

						local folder = ServerStorage.BritanWeapons

						for _, object in pairs(folder:GetChildren()) do --Gets All the Weapons in the BRITAN folder
							newObject = object:Clone()
							newObject.Parent = player.Backpack
						end
					end	
				end
					
				
			else
				
				if not player then
					if player.Team == Teams["Union"] then
						table.remove(team1,i)
					end

					if player.Team == Teams["Britan"] then
						table.remove(team2,i)
					end  
				end
				
			end
		end
	end
2 Likes

Might not be this but here
image

It should be:

local character = player.Character

You forgot the “local” part.

Also, you should use task.wait() instead of wait().

1 Like

Maybe use elseif instead of just “if” on the part where you check the teams and remove available spawnpoints to tp to?

1 Like