How can I add team filter to this damage zone script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I’m trying to make a damage zone, but cuz a player of a team can trigger it, I would like to filter which player can be damaged (for exemple his allies)

  2. What is the issue? The zone damage the player who trigger it

Here is the code

local allies = {
	"SH",
	"Pizza",
	"Obamium",
	"BigShaq",
	"IKEA",
	"SCP-035",
	"SCP-049",
	"SCP-076",
	"SCP-106",
	"SCP-407",
	"SCP-457",
	"SCP-745"
}

local Team = game:GetService("Teams")
local players = game:GetService("Players")
local Hits = {}

game.ReplicatedStorage.MusicSCP.OnServerEvent:Connect(function()
	script.Parent.Head.Music:Resume()
	local part = script.Parent.FireDamageZone
	local min = Vector3.new(part.Position.X-part.Size.X/2, part.Position.Y-part.Size.Y/2, part.Position.Z-part.Size.Z/2)
	local max= Vector3.new(part.Position.X+part.Size.X/2, part.Position.Y+part.Size.Y/2, part.Position.Z+part.Size.Z/2)
	local Region = Region3.new(min, max)
	
	while wait(1) do
		for _, Hit in pairs(game.Workspace:FindPartsInRegion3(Region, nil,math.huge)) do
			local plr = players:GetPlayerFromCharacter(Hit.Parent)
			if Hit.Parent:FindFirstChild("Humanoid") then
				if Hits[Hit.Parent.Name] then
						continue
					end
				Hits[Hit.Parent.Name] = true
					Hit.Parent.Humanoid:TakeDamage(20)
					delay(1, function()
						Hits[Hit.Parent.Name] = nil
					end)
				end
		end
	end
end)

game.ReplicatedStorage.MusicSCPStop.OnServerEvent:Connect(function()
	script.Parent.Head.Music:Stop()
end)

When getting the player to damage, you can check their Team property and see if it’s equal to the player’s team and if it is, use return to stop the function.

Such as this : ?

				if Hits[plr.Team == table.find(allies,plr.Team.Name)] then
					return
				end