@Seerah
You're right. The function is a relict from the old script within the UI I had only copied.
@Torhal
Thanks to you it works fine
@SDPhantom
with (maxXP == 0) the script throw a error if I want to display the value in a tooltip because of the nil-value.