I’m working with NPCs in my game and usally this isn’t a problem because there are no movements that take 8 seconds. But I have an NPC with a very slow walkspeed that just stops. After I remembered the 8 second timeout I started looking for solutions.
I found this code off of the developer hub but the problem comes when the movement is finished. After my NPC stops moving, it waits the 8 second timeout before triggering the callback function passed in thus making the NPC stand there for 8 seconds before doing the next thing.
function MoveNPC(Point, Character)
local HRP = Character.HumanoidRootPart
repeat
wait()
Character.Humanoid:MoveTo(Point)
until (HRP.Position - Vector3.new(Point.X, HRP.Position.Y, Point.Z) ).magnitude <= 1
end