Given coordinates are
A(5,-1) and B(x,4).
The point B is in the second quadrant.
Now,
[tex]\begin{gathered} AB=13 \\ \sqrt[]{(5-x)^2+(-1-4)^2}=13 \\ \sqrt[]{(5-x)^2+25}=13 \\ (5-x)^2+25=169 \\ (5-x)^2=144 \\ 5-x=\pm12 \\ x=17,-7 \end{gathered}[/tex]Since the point B is in second quadrant, x can't be positive.
Therefore, the value of x is -7.