local f local V=nil local X=nil local n=nil local function K()return Player and Player.Character end local function A(A)if A==V then return end if X then X:Disconnect()X=nil end if n then n:Disconnect()n=nil end V=A f={K()}if V~=nil then local K=CollectionService:GetTagged(V)for V,X in ipairs(K)do table.insert(f,X)end X=(CollectionService:GetInstanceAddedSignal(V)):Connect(function(V)table.insert(f,V)end)n=(CollectionService:GetInstanceRemovedSignal(V)):Connect(function(V)for X=1,#f,1 do if f[X]==V then f[X]=f[#f]table.remove(f)break end end end)end end local function r()if f then return f end f={}table.insert(f,K())return f end
--------------------------CHARACTER CONTROL-------------------------------
local CurrentIgnoreList
local CurrentIgnoreTag = nil

local TaggedInstanceAddedConnection = nil
local TaggedInstanceRemovedConnection = nil

local function GetCharacter()
	return Player and Player.Character
end

local function UpdateIgnoreTag(newIgnoreTag)
	if newIgnoreTag == CurrentIgnoreTag then
		return
	end
	if TaggedInstanceAddedConnection then
		TaggedInstanceAddedConnection:Disconnect()
		TaggedInstanceAddedConnection = nil
	end
	if TaggedInstanceRemovedConnection then
		TaggedInstanceRemovedConnection:Disconnect()
		TaggedInstanceRemovedConnection = nil
	end
	CurrentIgnoreTag = newIgnoreTag
	CurrentIgnoreList = { GetCharacter() }
	if CurrentIgnoreTag ~= nil then
		local ignoreParts = CollectionService:GetTagged(CurrentIgnoreTag)
		for _, ignorePart in ipairs(ignoreParts) do
			table.insert(CurrentIgnoreList, ignorePart)
		end
		TaggedInstanceAddedConnection = CollectionService:GetInstanceAddedSignal(CurrentIgnoreTag)
			:Connect(function(ignorePart)
				table.insert(CurrentIgnoreList, ignorePart)
			end)
		TaggedInstanceRemovedConnection = CollectionService:GetInstanceRemovedSignal(CurrentIgnoreTag)
			:Connect(function(ignorePart)
				for i = 1, #CurrentIgnoreList do
					if CurrentIgnoreList[i] == ignorePart then
						CurrentIgnoreList[i] = CurrentIgnoreList[#CurrentIgnoreList]
						table.remove(CurrentIgnoreList)
						break
					end
				end
			end)
	end
end

local function getIgnoreList()
	if CurrentIgnoreList then
		return CurrentIgnoreList
	end
	CurrentIgnoreList = {}
	table.insert(CurrentIgnoreList, GetCharacter())
	return CurrentIgnoreList
end
