If Unit().Hp and Unit().MaxHp are integers then it'll cause a problem showing a float.
Really though things like hit points should always be whole numbers to make it easier to work with... in real life there is no such thing as being half-hit.
My way to do a health bar (I'm too lazy to modify this for Image Kit):
hide mouse
` Define the starting health
MaxHealth=500
Health=MaxHealth
` Make a health bar background image
box 0,0,112,30
ink rgb(10,10,10),0
box 1,1,111,29
get image 2,0,0,112,30,1
` Make the health bar image
ink rgb(255,0,0),0
box 0,0,110,28
get image 1,0,0,110,28,1
` Create a timer
tim=timer()
ink rgb(255,255,255),0
do
` Show the health bar background
paste image 2,mousex()-1,mousey()-1,1
` Show the health bar
sprite 1,mousex(),mousey(),1
` Show the Health in text form
center text mousex()+55,mousey()+35,"Health "+str$(Health)+" / "+str$(MaxHealth)
` Show the health percentage (same variable for stretch sprite)
center text mousex()+55,mousey()+52,str$(HPercentage)+"% "+"Health Left"
` Check if the timer is up
if timer()>tim+100 and Health>0
` Decrease the health
dec Health
` Calculate the current health percentage (for stretch sprite)
HPercentage=(Health*100)/MaxHealth
` Stretch the sprite to the percentage of health left
stretch sprite 1,HPercentage,100
` Reset timer
tim=timer()
endif
` Check if the health is zero and reset to MaxHealth
if Health=0 then Health=MaxHealth
loop