This code was tested with Cheat Engine freezing the value, not tested with trainers (bcs for me not works ;c)
HP <- 0;
Local <- FindLocalPlayer ( );
function onClientShot ( pPlayer, Weapon, Part ) {
local Set = false;
if ( HP != Local.Health ) {
HP = Local.Health;
Set = true;
}
if ( HP == Local.Health && Set == false ) {
Message ( "Trainer! ;c" );
Local.Health = 0; // Kill or something
}
}