function PlayerManager.SetGameRunning(M,d)GameRunning=d end function PlayerManager.AllowPlayerSpawn(M,d)PlayersCanSpawn=d end function PlayerManager.ClearPlayerScores(d)for d,M in ipairs(Players:GetPlayers())do local b=M:FindFirstChild("\108\101\097\100\101\114\115\116\097\116\115")if b then local d if Configurations.GRANT_ASSISTS then d=b:FindFirstChild("\075\079 - \087\079 - \065")if d then d.Value="\048 - \048 - \048"end else d=b:FindFirstChild("\075\079 - \087\079")if d then d.Value="\048 - \048"end end end end end function PlayerManager.LoadPlayers(d)for d,M in pairs(Players:GetPlayers())do M:LoadCharacter()end end function PlayerManager.DestroyPlayers(d)for d,M in pairs(Players:GetPlayers())do M.Character:Destroy()for d,M in pairs(M.Backpack:GetChildren())do M:Destroy()end end ResetMouseIcon:FireAllClients()end function PlayerManager.PlayerHit(b,d,M)if d==M then return end if not HitArray[d]then HitArray[d]={}end for b=1,#HitArray[d],1 do if HitArray[d][b]==M then return end end table.insert(HitArray[d],M)end function PlayerManager.PlayerDied(M,d)if HitArray[d]then for M=#HitArray[d],1,-1 do local b=HitArray[d][M]if b~=d then if M==#HitArray[d]then ScoreArray[b][1]=ScoreArray[b][1]+1 TeamManager:AddTeamScore(b.TeamColor,1)spawn(function()pcall(function()PointsService:AwardPoints(b.userId,Configurations.PLAYER_POINTS_PER_KO)end)end)else ScoreArray[b][3]=ScoreArray[b][3]+1 spawn(function()pcall(function()PointsService:AwardPoints(b.userId,Configurations.PLAYER_POINTS_PER_ASSIST)end)end)end UpdatePlayerScore(b)end end end ScoreArray[d][2]=ScoreArray[d][2]+1 HitArray[d]=nil UpdatePlayerScore(d)end

function PlayerManager:SetGameRunning(running)
	GameRunning = running
end

function PlayerManager:AllowPlayerSpawn(allow)
	PlayersCanSpawn = allow
end

function PlayerManager:ClearPlayerScores()
	for _, player in ipairs(Players:GetPlayers()) do
		local leaderstats = player:FindFirstChild("leaderstats")
		if leaderstats then
			local KWA
			if Configurations.GRANT_ASSISTS then
				KWA = leaderstats:FindFirstChild("KO - WO - A")
				if KWA then
					KWA.Value = "0 - 0 - 0"
				end
			else
				KWA = leaderstats:FindFirstChild("KO - WO")
				if KWA then
					KWA.Value = "0 - 0"
				end
			end
		end
	end
end

function PlayerManager:LoadPlayers()
	for _, player in pairs(Players:GetPlayers()) do
		player:LoadCharacter()
	end
end

function PlayerManager:DestroyPlayers()
	for _, player in pairs(Players:GetPlayers()) do
		player.Character:Destroy()
		for _, item in pairs(player.Backpack:GetChildren()) do
			item:Destroy()
		end
	end
	ResetMouseIcon:FireAllClients()
end

function PlayerManager:PlayerHit(hitPlayer, hittingPlayer)
	if hitPlayer == hittingPlayer then
		return
	end
	
	if not HitArray[hitPlayer] then
		HitArray[hitPlayer] = { }
	end
	
	for i = 1, #HitArray[hitPlayer] do
		if HitArray[hitPlayer][i]== hittingPlayer then
			return
		end
	end
	table.insert(HitArray[hitPlayer], hittingPlayer)
end

function PlayerManager:PlayerDied(player)
	if HitArray[player] then
		for i = #HitArray[player], 1, -1 do
			local hittingPlayer = HitArray[player][i]
			if hittingPlayer ~= player then
				if i == #HitArray[player] then
					ScoreArray[hittingPlayer][1] = ScoreArray[hittingPlayer][1] + 1
					TeamManager:AddTeamScore(hittingPlayer.TeamColor, 1)
					spawn(function() pcall(function() PointsService:AwardPoints(hittingPlayer.userId, Configurations.PLAYER_POINTS_PER_KO) end) end)
				else
					ScoreArray[hittingPlayer][3] = ScoreArray[hittingPlayer][3] + 1
					spawn(function() pcall(function() PointsService:AwardPoints(hittingPlayer.userId, Configurations.PLAYER_POINTS_PER_ASSIST) end) end)
				end
				UpdatePlayerScore(hittingPlayer)
			end
		end
	end
	
	ScoreArray[player][2] = ScoreArray[player][2] + 1
	HitArray[player] = nil
	UpdatePlayerScore(player)
end
