Skip to main content

GetClosestObject

Finds the closest object within a specified distance from the player's current location.

Parameters

  • maxDistance: The maximum distance within which to search for the model (number).

Returns

  • closestObj: The object it found
  • closestDist: The distance to that object
  • closestCoords: The coords of the object

Usage

local closestPed, closestDist, closestCoords = exports['FS-Lib']:GetClosestObject(10.0)