Why isn't the character taking damage?

Hey i’m trying to make it so when a player would die it woudln’t it would just stay at 1 hp so im doing that by making a damage script that starts everytime an event is being fired.

The problem is that the damage isn’t happending like the player ain’t taking any damage.

Here is my damage script:

game.ReplicatedStorage.DamageEvents.Damage.Event:Connect(function(Char, Damage)
	print("Damage is happening")
	local Health = Char.Humanoid.Health
	if Damage < Health then
		Health -= Damage
		Health = 1

And here is the one that fires the damage script

if HitPart.Parent:FindFirstChild("Humanoid") ~= nil and Char.Name ~= Player.Character.Name and HitPart.Name ~= "Head" then
			game.ReplicatedStorage.DamageEvents.Damage:Fire(Char, 40)
		elseif HitPart.Parent.Name ~= Player.Character.Name and HitPart.Parent:FindFirstChild("Humanoid") ~= nil or  Char ~= nil and Char.Name ~= Player.Character.Name and HitPart.Parent:FindFirstChild("Humanoid") then
			game.ReplicatedStorage.DamageEvents.Damage:Fire(Char, 70)

The script is inside a raycast, dm me if you need more of the script.
It’s a tool btw(Revolver)

I figured it out. The solution was to change the health variable inside the if staments like i just made it say Char.Humanoid.Health -= Damage. IDK why it worked but it did.

But im still wondering why it didn’t work

This probably didn’t work because you need to reference values rawly instead of using variables for them. Make sure to mark your post or mine as the solution!

local Health = Char.Humanoid.Health

This line here is just assigning the current value of the humanoid’s health property to the variable named “Health”. When you later decrease/increase the value of this variable the change is only applied to the variable.

You instead need to index the humanoid’s health property each time you want to change its value.

local Humanoid = Char.Humanoid
Humanoid.Health -= 100

In addition to this, Roblox has an instance method that is called on a humanoid instance which can be used to increase/decrease that humanoid’s health.

humanoid:TakeDamage(10) --Decrease humanoid's health by 10.
humanoid:TakeDamage(-10) --Increase humanoid's health by 10.