Let me explain. Basically, the first script is in charge of making the character go invisible...

wait(.5)
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")
local Key = "Q"
local Visibility = 0

local function ToggleVisibility(toggle)
    -- Reverse the visibility
    -- You could also replace the if-statement with this: "Visibility = Visibility == 0 and 1 or 0" 
    if Visibility == 0 then
        Visibility = 1
    else
        Visibility = 0  
    end

    if plr.Team.Name == "Foundation Personnel" or plr.Team.Name == "Internal Security Department" then
        wait(.8)
        for _, Part in pairs(char:GetDescendants())do
            if (Part:IsA("BasePart") or Part:IsA("MeshPart")) and Part.Name ~= "HumanoidRootPart" then
                Part.Transparency = Visibility
                char.Head.face.Transparency = Visibility
            end
        end 
    end  
end

UserInputService.InputBegan:Connect(function(Input,GameStuff)
    if Input.KeyCode == Enum.KeyCode[Key] then
        ToggleVisibility()
    end
end)

The problem with this script, is it works standalone, and only on one team. For example, say the next script right below this one is on, it will not work. And say I switch to Internal Security Department, it will still not work.

This next script just flat out breaks the other one and nothing works...

wait(.5)
local UserInputService = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local charname = char.Name


UserInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Q then
		if plr.Team.Name == ("Foundation Personnel") or plr.Team.Name == ("Internal Security Department") then
			local cloneSmoke = game.ServerStorage:WaitForChild("Smoke")
				local cloneSmoke2 = cloneSmoke:Clone()
				cloneSmoke2.Parent = char.UpperTorso
				local poofsound = game.ServerStorage["Poof sound"]:Clone()
				poofsound.Parent = char.UpperTorso
				poofsound:Play()
				wait(1)
				cloneSmoke.Enabled = false
				cloneSmoke:Destroy()
				poofsound:Destroy()
			end
		end
end)


Any suggestions on what approach I should take on this?

Let me explain the teams now...

The teams are a very complicated manuver, as the teams essentially get pulled out, as someone clicks them from a GUI. Once the team is pulled out, it is displayed on the top right corner. If you are wondering what happens in the Explorer, the teams are dragged out of ServerStorage, into teams, and then displayed. Along with that, the character in question that requested that team change will be immediately added to that team.

And it does not stop there. Sometimes it works, and sometimes it does not work. I have NO IDEA what is causing it, but sometimes both scripts running at the same time work, and most of the time it just flat out breaks.

Any help or suggestions on maybe I should combing the scripts together? (I have literally no idea how to do that) or maybe switching some things up in the script?

Thanks!