See Other Invisible Team Members

I have an invisbility system, and I wanted to know how I can make it so you can see other invisible people on your team. Here is the client script:

-- services
local players = game:GetService('Players')
local userInputService = game:GetService('UserInputService')

-- player
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local Teams = game:GetService("Teams")
local Player = game.Players.LocalPlayer

-- remotes
local cloakEvent = game:GetService("ReplicatedStorage").CloakRemote

-- variables
local delayTick = (tick() - 9e8)
local invisible = false
local validTeams = { 
	'Internal Security Department',
	'Intelligence Agency',
}

userInputService.InputBegan:Connect(function(Input, gameProcessedEvent)
	if not gameProcessedEvent and Input.KeyCode == Enum.KeyCode.Q and (player.Team and table.find(validTeams, player.Team.Name)) and (tick() - delayTick) >= 1 then
		invisible = not invisible
	

		cloakEvent:FireServer(invisible and 1 or 2, character)
		wait(.5) -- Everything below this makes it so you can see yourself partialy when invisible.
		player.Character.Head.Transparency = 0
		player.Character.UpperTorso.Transparency = 0
		player.Character.LowerTorso.Transparency = 0
		player.Character.LeftFoot.Transparency = 0
		player.Character.LeftHand.Transparency = 0
		player.Character.LeftLowerArm.Transparency = 0
		player.Character.LeftLowerLeg.Transparency = 0 
		player.Character.LeftUpperArm.Transparency = 0
		player.Character.LeftUpperLeg.Transparency = 0
		player.Character.RightFoot.Transparency = 0
		player.Character.RightHand.Transparency = 0
		player.Character.RightLowerArm.Transparency = 0
		player.Character.RightLowerLeg.Transparency = 0
		player.Character.RightUpperArm.Transparency = 0
		player.Character.RightUpperLeg.Transparency = 0
		delayTick = tick()
	end
end)

I appreciate any help I can get, I’ve looked around on how to do this.

function RevealTeammates()
 for i,v in pairs(game.Players:GetPlayers()) do
	local Character = v.Character or v.CharacterAdded:Wait()
	if Character then
		if v.Team == game.Players.LocalPlayer.Team then
			for x,c in pairs(Character:GetDescendants()) do
				pcall(function()
					c.Transparency = 0
				end)
			end
		end
	end
 end
end
2 Likes

Where would I put that in the script? And would I call the function by doing RevealTeammates() anywhere?

put it anywhere in localscript call it whenever wherever