That's because there are two variables called (x, y)
and the 2nd variables only will be called here
Try this
if playerTarget then
local xp,yp,zp = getElementPosition(playerTarget)
local x,y,distance = getScreenFromWorldPosition (xp,yp,zp+0.5)
distance = 30
if getElementData(playerTarget,"bandit") then
text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) else
text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ) end
local w = dxGetTextWidth(text,distance*0.033,"default-bold")
if w and x and y and text and distance then
dxDrawText ( text.."("..(getDistanceBetweenPoints3D( xp,yp,zp, getElementPosition ( localPlayer )))..")",x-(w/5),y,x-(w/5),y,tocolor(100, 255, 100, 200),distance*0.033,"bankgothic") end end end);