I just dont have idea why he does this
while enemy ~= nil do
wait()
local dist = (enemy.HumanoidRootPart.Position - char.HumanoidRootPart.Position).Magnitude
if dist < FollowDist and dist > BlockDist then
print("Go to player")
local path = PathfindingService:CreatePath()
path:ComputeAsync(char.HumanoidRootPart.Position, enemy.PrimaryPart.Position)
local waypoints = path:GetWaypoints()
for waypointIndex, waypoint in pairs(waypoints) do
local waypointPosition = waypoint.Position
print(waypointPosition)
char.Humanoid:MoveTo(waypointPosition)
end
elseif dist < BlockDist and dist > AttackDist then
char.Humanoid:MoveTo(char.PrimaryPart.Position)
print("Dash or block")
elseif dist < AttackDist then
print("attack")
end
end
EDIT: Added char.Humanoid.MoveToFinished:Wait() but it still hops