checkDistance

Checks if player is within a certain distance of a location.

Parameters:

  • source (number): Player server ID

  • location (table): Location with x, y, z coordinates

  • distance (number, optional): Maximum distance - default: 2.5

Returns:

  • boolean: True if within distance

Example:

local bankLocation = {x = 150.0, y = -1040.0, z = 29.0}
if ps.checkDistance(source, bankLocation, 5.0) then
    print("Player is near the bank")
end

Last updated