----------------------
---define variables---
----------------------

local pathfinding=game:GetService("PathfindingService");--the service used to compute paths
local AI=script.Parent;--the AI
local humanoid=AI:WaitForChild("Humanoid");--the Humanoid object
local torso=AI:WaitForChild("Torso");--the Torso object