Skip to content

GetNearestWorldItem

The loose item slot nearest to a point, within a radius.

GetNearestWorldItem(x, y, z [, radius])
Parameter Type
x number the point, metres
y number
z number
radius number metres; 0 or none = no limit (optional)

string, number - the slot’s key and its distance; nil when none

local key = GetNearestWorldItem(x, y, z, 2)
if key then RespawnWorldItem(key) end

GetWorldItemPosition · GetNearestDoor · OnPlayerTakeWorldItem · the Doors and containers group of the index