if script.Owner.Value.Character~=nil and script.Owner.Value.Character:FindFirstChild("\072\117\109\097\110\111\105\100")then local l=false local y=game.ReplicatedStorage.Interactions.Server.Perks.MakeInvisible.OnServerEvent:connect(function(y)if not l and(script.Owner.Value.Character~=nil and y==script.Owner.Value)then l=true local y=game.ServerScriptService.RoundManager.GetPlayersInGame:Invoke()for l,S in pairs(y)do if S==script.Owner.Value then table.remove(y,l)break end end for l,y in pairs(y)do game.ReplicatedStorage.Interactions.Client.ChangeCharacterVisibility:FireClient(y,script.Owner.Value,true)end for l,S in pairs(game.Players:GetPlayers())do local T=false for l,y in pairs(y)do if y==S then T=true break end end if not T then game.ReplicatedStorage.Interactions.Client.ChangeCharacterVisibility:FireClient(S,script.Owner.Value,false)end end wait(COOLDOWN)l=false end end)script.Owner.Value.Character.Humanoid.Died:connect(function()y:disconnect()y=nil end)game.ReplicatedStorage.Interactions.Client.Perks.UseInvisibility:FireClient(script.Owner.Value)end
-- Check if character is there
if script.Owner.Value.Character ~= nil and script.Owner.Value.Character:FindFirstChild("Humanoid") then
	-- Listen for invisibility activation
	local debounce = false
	local event = game.ReplicatedStorage.Interactions.Server.Perks.MakeInvisible.OnServerEvent:connect(function(plr)
		-- Make sure correct player
		if not debounce and script.Owner.Value.Character ~= nil and plr == script.Owner.Value then
			debounce = true

			-- Tell all playing players to make murderer invisible
			local playingPlrs = game.ServerScriptService.RoundManager.GetPlayersInGame:Invoke()
			for n, i in pairs(playingPlrs) do
				if i == script.Owner.Value then
					table.remove(playingPlrs, n)
					break
				end
			end
			for _, i in pairs(playingPlrs) do
				game.ReplicatedStorage.Interactions.Client.ChangeCharacterVisibility:FireClient(
					i,
					script.Owner.Value,
					true
				)
			end

			-- Tell everyone else to make murderer half-transparent
			for _, i in pairs(game.Players:GetPlayers()) do
				local playing = false
				for _, o in pairs(playingPlrs) do
					if o == i then
						playing = true
						break
					end
				end
				if not playing then
					game.ReplicatedStorage.Interactions.Client.ChangeCharacterVisibility:FireClient(
						i,
						script.Owner.Value,
						false
					)
				end
			end

			-- Wait cooldown
			wait(COOLDOWN)

			debounce = false
		end
	end)

	-- Connect character death
	script.Owner.Value.Character.Humanoid.Died:connect(function()
		event:disconnect()
		event = nil
	end)

	-- Activate perk for client
	game.ReplicatedStorage.Interactions.Client.Perks.UseInvisibility:FireClient(script.Owner.Value)
end
