Humanoid Health doesn't change after cooldown

I have a humanoid inside a model, but it’s Health doesn’t go back after the cooldown. This is supposed to be a very simple problem to solve, but it doesn’t work and I’m very confused about it. I’m not getting any error messages, and when I print the health it states ‘100’ even though it’s 0.

  1. What do you want to achieve? Keep it simple and clear!
    I’m attempting to make a damagable part with health that drops cash when its at 0 and the cooldown is false
  2. What is the issue? Include screenshots / videos if possible!
    when I run the code, it successfully is damaged and drops cash, but after the cooldown the Health still stays at 0. I’m not sure if this is relevant, but this is inside a server script
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried searching online for others with similar issues, but I don’t see anything. Are server scripts able to change health values?

(the problem is line 12)

Humanoid.HealthChanged:Connect(function()
	if COOLDOWN == false and health2.Value <= 0 then
		robbed.Value = true
		game.ReplicatedStorage.health:FireAllClients(robbed == true)
		COOLDOWN = true
		sound:Play()
	close.Transparency = 1
	close.CanCollide = false
	open.Transparency = 0
		open.CanCollide = true
		wait(cooldown_time)
		Humanoid.Health = Humanoid.MaxHealth -- the problem 
		print(script.Parent.Humanoid.Health) --prints 100 even though its 0
		close.Transparency = 0
		close.CanCollide = true
		open.Transparency = 1
		open.CanCollide = false
		COOLDOWN = false
		end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

When a Humanoid dies, it dies—you cannot reverse its death. The Humanoid.Health property will simply return to 0.

FYI, robbed == true can be simplified to just true.

Are you damaging the humanoid on the server or the client? I believe humanoid.Health is a non-streaming value, meaning local deaths only appear on the client.

If the humanoid is being damaged by a local script, consider utilizing server scripts to damage the humanoid and see if that works.

ohh, I always thought they automatically respawned. would making a line to destroy the original humanoid and make a new one after the cooldown work?

Unless disabled, players will respawn automatically.

As this happens, your reference to the current Humanoid “expires”. You will need to update your reference to the new Humanoid instance. However, in the context of your code, your intentions with said Humanoid seem to be redundant.