i have a little problem, How i can do that when the NPC are following you, its speed changes?

Here is the script

function findNearestTorso(pos)  --  declare pos a local vector3
	local list = game.Workspace:children()
	local torso = nil
	local dist = 25  -- Area to search
	local temp = nil
	local human = nil
	local temp2 = nil
	for x = 1, #list do
		temp2 = list[x]
		if temp2.className == "Model" then
			temp = temp2:findFirstChild("Torso")
			if temp ~= nil then
				human = temp2:findFirstChild("Humanoid")
				if human ~= nil and (human.Health > 0) and (temp2.Name ~= AIName) then -- not named the same as us.
					if (temp.Position - pos).magnitude < dist then
						torso = temp
						dist = (temp.Position - pos).magnitude
					end  --  closer?
				end   --  human? Not us. 
			end -- Has torso?
		end   --  Model? 
	end  --  For. Loop thru parts in Workplace

	return torso
end