I need it client side, this is what I tried:
local sx, sy = guiGetScreenSize ( )
local tx, ty, tz = getWorldFromScreenPosition ( sx / 2, sy / 2, 7 )
local px, py, pz = getCameraMatrix ( )
local hit, _, _, _, elementHit = processLineOfSight ( px, py, pz, tx, ty, tz, true, true, true, true, true, false, false, false, localPlayer )
if ( hit and isElement ( elementHit ) and getElementType ( elementHit ) == "player" ) then
local px, py, pz = getElementPosition ( elementHit )
outputChatBox ( "hit: ".. tostring ( getPlayerName ( elementHit ) ) )
end
The problem is that it hardly detects it, plus, I don't want it to be camera based, since I could just turn around and look at a player and it would return it.