Humanoid hp problem

Hello devs!
I have so eazy script:

while wait(0.5) do
	workspace.NPCs.RegeneratingHpNPC.Humanoid.Health = 100

And it just dont work lol, first time it regenerate hp but after it script dont work.
I mean script works but it dont doing what it must do
Script in ServerScriptService
Sorry for grammar

How many NPC’s do you have? Because it’s only doing it for one of them.

Here only one npc named this name

How do you know it’s not working? Are there any errors?

It just dont regen hp, i mean it regen first time but after this one time it dont regenerate hp. No errors

Oh I’m an idiot,

I’m pretty sure it only loops once, do while wait() do instead of while wait(0.5) because that’s not infinite. It only does the loop for 0.5 seconds. Try putting a print there also.

Ignore, I did a big dumb ^^

can you kill him after the first regeneration? cuz i think the script making his health to 100 every 0.5 seconds

Print works fine, it print what you want every 0.5 second and after this bug too

this line is confusing for me the loop is running every 0.5 second wdym


while true do
     workspace.NPCs.RegeneratingHpNPC.Humanoid.Health = 100

this code makes his health to 100 every 5 second try to get 50 hp from his health after first regeneration and tell me what happenes

I think you’re killing it, have the properties viewed when you kill it and view the health and what’s happening to the humanoid.

add print(health) in that while loop and tell me whats it printing

Is the damage client side? The damage needs to be done from the server for the regenning to work

It prints literally what you can see on screen with this npc health

Any errors? If so, try including them in the post. :sunglasses: Or just tell me now. :slight_smile:

Its server script in serverscriptservice

How i said before, it dont gives any errors

It can be because npc is being killed or something like that

Maybe add number value in it for its health and get the value from that numbervalue