-- functions:

local function disableCollisions(descendant)
	if not descendant:IsA("BasePart") then return end
	physicsService:SetPartCollisionGroup(descendant, "Characters")
end

local function enableCollisions(descendant)
	if not descendant:IsA("BasePart") then return end
	physicsService:SetPartCollisionGroup(descendant, "Default")
end

local function handleCharacter(character)
	for _, descendant in ipairs(character:GetDescendants()) do
		disableCollisions(descendant)
	end
	character.DescendantAdded:Connect(disableCollisions)
	character.DescendantRemoving:Connect(enableCollisions)
end

local function handleNPcs(v)
	for _, descendant in ipairs(v:GetDescendants()) do
		disableCollisions(descendant)
	end
end

