Get the target closest to the AI||doc135584

September 20, 2022

Format

 AIControl:getNearestEnemy()
  • The class to which the function belongs:AIControl

Description

Get the selectable target entity closest to the AI.


Value Returned

type Description
Entity entity

Code Samples

on the entity object servermount script, get the selectable target entity closest to the AI

local control = this:getAIControl()
local nearestEnemy = control:getNearestEnemy()