local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")
local Key = "Q"
local Visible = true
local function Visibility(Var)
	if Var then
		for i,v in pairs(game.Teams["Foundation Personnel"]:GetPlayers()) and (game.Teams["Internal Security Department"]:GetPlayers()) do
			if v == game.Players.LocalPlayer then
				wait(.8)
				for _, Part in pairs(char:GetDescendants())do
					if Part:IsA("BasePart") or Part:IsA("MeshPart") then
						Part.Transparency = 0
						char.Head.face.Transparency = 0
						char.HumanoidRootPart.Transparency = 1 
					end
				end
			end
		end 
	else
		for i,v in pairs(game.Teams["Foundation Personnel"]:GetPlayers()) and (game.Teams["Internal Security Department"]:GetPlayers()) do
			if v == game.Players.LocalPlayer then
				wait(.8)
				for _, Part in pairs(char:GetDescendants())do
				if Part:IsA("BasePart") or Part:IsA("MeshPart") then
				Part.Transparency = 1
				char.Head.face.Transparency = 1
			end
		end 
			end
		end   
	end 
end
UserInputService.InputBegan:Connect(function(Input,GameStuff)
	if GameStuff then return end
	if Input.KeyCode == Enum.KeyCode[Key] then
		if Visible then
		Visibility(false)
		Visible = false
			else
			Visibility(true)
			Visible = true  
		end 
	end
end)

The for i,v is to check if the people in Foundation Personnel and Internal Security Department are matching the name of the key called by the player, but it is not working. How can I make it so it checks multiple teams at once? When I tried to copy the script in two and set them for different teams, it breaks the whole thing.