operators in lua, or any programming language, really, have this thing called "operator precedence"—if you've ever heard of order of operations, PEMDAS, BODMAS, whatever, it's kind of like that but with lua operators
if you're not sure what exactly is considered an "operator", there's a full list of them and their precendences
the not operator has higher precedence over all of the comparison operators, and not gets the opposite of whether a value is truthy, so when you do not workspace[targetName].Humanoid.Health <= 0, it gets turned into false <= 0, and then the script throws an error because you obviously can't check if a boolean is less than or equal to a number
instead you have two other options
you can wrap the workspace[targetName].Humanoid.Health <= 0 part in parentheses, turning it into this:
if not (workspace[targetName].Humanoid.Health <= 0) then
or, you could just use the greater than operator
if workspace[targetName].Humanoid.Health > 0 then
2 comments
Try to print the workspace[targetName].Humanoid.Health and see what value it is.
I tried that @Soban06, it prints the current health in a number.