isAlive works fine. I'd recommend using it where you can. It checks both that the entity exists and that it isn't dead. Something to bear in mind though, is that a player is still classed as alive when in spectator. They will also have 100 health in spectator. if (local.player != NIL && local.player != NULL && local.player.health > 0)
is the same as if (isAlive local.player)
By the way, you don't need to check for crouching by running this script from the state machine (mike_torso). The states are already checked by the game and exposed as functions (getmovement & getposition). You will want getposition.
So you can call this script every time a new player connects or spawns, and then do:
main:
if(self.startCrouchLoop == 1)
end
self.startCrouchLoop = 1
thread crouchLoop self
end
crouchLoop local.player:
while(local.player) {
//1 health-point gets added every 0.3 second
if(local.player getposition == "crouching" && isAlive local.player)
local.player heal 0.05
wait 0.3
}
end