while true do ClosestHead=nil ClosestDistance=MaxDistance CharacterHeads={}for v,N in pairs(workspace.Characters:GetChildren())do if N:IsA("\077\111\100\101\108")and N:FindFirstChild("\072\101\097\100")then table.insert(CharacterHeads,N.Head)end end for v,N in pairs(CharacterHeads)do Distance=(N.Position-NPCHead.Position).Magnitude if Distance<ClosestDistance then ClosestDistance=Distance ClosestHead=N end end if ClosestHead~=nil then(TweenService:Create(NPCHead,TweenInfo.new(.5),{CFrame=lookAt(NPCHead.Position,ClosestHead.Position)})):Play()else(TweenService:Create(NPCHead,TweenInfo.new(.5),{CFrame=OriginalHeadCF})):Play()end wait()end
--- RUNTIME ---

while true do
	-- Get closest character head
	ClosestHead = nil
	ClosestDistance = MaxDistance
	CharacterHeads = {}
	for _, Character in pairs(workspace.Characters:GetChildren()) do
		if Character:IsA("Model") and Character:FindFirstChild("Head") then
			table.insert(CharacterHeads, Character.Head)
		end
	end

	for _, Head in pairs(CharacterHeads) do
		Distance = (Head.Position - NPCHead.Position).Magnitude

		if Distance < ClosestDistance then
			ClosestDistance = Distance
			ClosestHead = Head
		end
	end

	-- Look at closest character head or reset to original position if none found
	if ClosestHead ~= nil then
		-- Look at
		TweenService:Create(NPCHead, TweenInfo.new(0.5), { CFrame = lookAt(NPCHead.Position, ClosestHead.Position) })
			:Play()
	else
		TweenService:Create(NPCHead, TweenInfo.new(0.5), { CFrame = OriginalHeadCF }):Play()
	end

	wait()
end
