local shown =falselocal inDistance =falsewhiletruedo inDistance =false-- your codeif playerDistance <= distance then inDistance =true-- your code when you are inside the rangeelse-- your code when you are outside the rangeendifnot shown and inDistance then exports['okokTextUI']:Open('[E] Hello', 'lightgreen', 'right', true) shown =trueelseif shown andnot inDistance then exports['okokTextUI']:Close() shown =falseendend
Example (loop)
whiletruedo-- your codeif playerDistance <= distance then exports['okokTextUI']:OpenThisFrame('[E] Hello', 'lightgreen', 'right', true)-- your code when you are inside the rangeelse-- your code when you are outside the rangeendend