Humanoid's health not changing after death

Hello! I am trying to make a script that changes a player’s health based on a value. But I am having a couple troubles, the player’s health does not change after death! It still stays at 100 when the value is still at a certain number.

local Players = game:GetService("Players")

local function onCharacterAdded(character)
	local player = Players:GetPlayerFromCharacter(character)
	local lb = player:FindFirstChild("leaderstats")
	lb.Strength.Changed:Connect(function()
		if lb.Strength.Value > 1 then
			character.Humanoid.MaxHealth = lb.Strength.Value * 2
		else
			character.Humanoid.Health = 1
			character.Humanoid.MaxHealth = 1
		end
	end)
end

local function onPlayerAdded(player)
	player.CharacterAdded:Connect(onCharacterAdded)
end

game.Players.PlayerAdded:Connect(onPlayerAdded)

I’ve tried moving the script to StarterScripts but no luck. Also tried adding a Died event but still no help.

See if this works:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharcterAdded:Connect(function(Char)
		local lb = Player:FindFirstChild("leaderstats")
		lb.Strength.Changed:Connect(function()
			if lb.Strength.Value > 1 then
				Char.Humanoid.MaxHealth = lb.Strength.Value * 2
				Char.Humanoid.Health = Char.Humanoid.MaxHealth
			else
				Char.Humanoid.MaxHealth = 1
				Char.Humanoid.Health = 1
			end
		end)
	end)
end)

Doesn’t work and I don’t want the humanoid’s HP being the same as the maxhealth. I wouldn’t want players healing during combat.

I think before you have the changed function you have to indicate that the value should equal the humaoid health. Before the lb.Strength.Changed function say lb.Strength.Value = char.Humanoid.Health.

Are you getting any errors in the output? Also, you should use :GetPropertyChangedSignal("Value") instead of .Changed.

Thank you! This fixed my problem.