auto(500)
local HOTKEY = "f5"
if $hp < 5000 then
keyevent(HOTKEY)
end
Basically this script would press F5 if your HP was below 5000. You can chage the f5 to f1 or f12 (whichever f key you choose) and change the 5000 to your desired hp amount. Hope this helps anyone in need.
I came up with this after looking at many other scripts on here so I really hope no one thinks I am stealing their work.