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