I tried the script while true do game.Workspace.Humanoid:TakeDamage(100) wait(0) end ,but when tested it I did not take any damage?
The Humanoid is usually located inside a model, not directly in the workspace.
while true do workspace.Model.Humanoid:TakeDamage(100) --rename "Model" to your NPC name. wait() end
I'm gonna explain this as simply as I can.
I'm gonna break it down as well.
Do not use while true do with a wait(0).
Instead, use
while wait() do
As the other answer states, use the method "TakeDamage", or set the health.
workspace.Model.Humanoid:TakeDamage(100)
It is generally easier to put prints in your code, and in some cases(not this one), use a pcall.
EDIT: been informed that this can't error so no need for a pcall, just print the health.
workspace.Model.Humanoid:TakeDamage(100) print(workspace.Model.Humanoid.Health)
Keep in mind this may not work EXACTLY, as I am writing this in the text and not testing in studio, but play around with this and it should work as you want it to. Happy to help!