There are two teams labeled Red Team and Blue Team respectively. How would i make this script not hurt anyone on the same team as the one who clicked on it?

player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function()
	if game.Players.NumPlayers > 0  then
		local player = math.random(1, game.Players.NumPlayers);
		local Players = game.Players:GetPlayers()
		local selected = (Players[player])
		script.Parent.Text = selected.Name
		selected.Character.Humanoid.Health = selected.Character.Humanoid.Health/2
		local torso = selected.Character.Torso
		local i = Instance.new('Fire')
		i.Parent = torso
		i.Color = Color3.new(0, 90, 236)
		i.SecondaryColor = Color3.new(0, 90, 236)
		wait(4)
		i:Destroy()
	end
end)