AI Optimization issue

I think these posts can answer your question:

Posts:

Task.wait(n) vs wait(n)
Task Library - Now Available! - Updates / Announcements - DevForum | Roblox
Avoiding wait() and why - Resources / Community Tutorials - DevForum | Roblox

Also, if you need character positions, try using Humanoid events, such as: