Path finding issue

got already 250ms. What would you suggest?

500ms. That script above should be different.