getNearbyObjects

Gets all objects within the specified distance.

Parameters:

  • coords (vector3, optional): The coordinates to search from. Defaults to player's current position.

  • distance (number, optional): Maximum search distance in units. Defaults to 25.0.

Returns:

  • objects (table): Array of tables containing {object = entity, distance = number}, or empty table if none found

Example:

local nearbyObjects = ps.getNearbyObjects(nil, 20.0)
print("Found " .. #nearbyObjects .. " objects nearby")

Last updated