This code may help, you will have to modify it to fit your script, however this is a basic layout of how you want it.
local x,y,z = getElementPosition(marker)
local sx,sy = getScreenFromWorldPosition(x-2,y,z+1)
local sw,sh = getScreenFromWorldPosition(x+2,3,z+1)-- 3 will be your text height.
addEventHandler('onClientRender',root,function()
dxDrawText('Marker Text',sx,sy,sw,sh)
end)
Hopefully this has helped you, have a nice day.