--print("intmoveTO")


function Zombie:moveTo()
	local targetReached = false
	local humanoid = self.Humanoid
	local targetPoint = self:FindPath()

	local connection
	connection = humanoid.MoveToFinished:Connect(function(reached)
		targetReached = true
		connection:Disconnect()
		connection = nil
		if Shetchik <= 5 then
			Zombie:moveTo()
		end
	end)
	if targetPoint ~= nil then
		humanoid:MoveTo(targetPoint)

		spawn(function()
			while not targetReached do
				if not (humanoid and humanoid.Parent) then
					break
				end
				if humanoid.WalkToPoint ~= targetPoint then
					break
				end
				humanoid:MoveTo(targetPoint)
				wait(6)
			end

			if connection then
				connection:Disconnect()
				connection = nil
			end
		end)
	end
end
	
	--print("Start")


return Zombie

