local function m(m)local E=Instance.new("\077\111\100\101\108",m)E.Name="\108\101\097\100\101\114\115\116\097\116\115"local M=Instance.new("\073\110\116\086\097\108\117\101",E)M.Name="\067\097\112\116\117\114\101\115"M.Value=0 TeamManager:AssignPlayerToTeam(m)m.CharacterAdded:connect(function(E)(E:WaitForChild("\072\117\109\097\110\111\105\100")).Died:connect(function()wait(Configurations.RESPAWN_TIME)if GameRunning then m:LoadCharacter()end end)end)if PlayersCanSpawn then m:LoadCharacter()else DisplayManager:StartIntermission(m)end end local function E(m)TeamManager:RemovePlayer(m)end
-- Local Functions
local function OnPlayerAdded(player)
	-- Setup leaderboard stats
	local leaderstats = Instance.new("Model", player)
	leaderstats.Name = "leaderstats"

	local Captures = Instance.new("IntValue", leaderstats)
	Captures.Name = "Captures"
	Captures.Value = 0

	-- Add player to team
	TeamManager:AssignPlayerToTeam(player)

	player.CharacterAdded:connect(function(character)
		character:WaitForChild("Humanoid").Died:connect(function()
			wait(Configurations.RESPAWN_TIME)
			if GameRunning then
				player:LoadCharacter()
			end
		end)
	end)

	-- Check if player should be spawned
	if PlayersCanSpawn then
		player:LoadCharacter()
	else
		DisplayManager:StartIntermission(player)
	end
end

local function OnPlayerRemoving(player)
	TeamManager:RemovePlayer(player)
end
