How do I make the value go up once and not more?

	local bloodLoss = char:WaitForChild('BloodLoss') :: NumberValue
	local tag = char:WaitForChild('Tag') :: StringValue
	humanoid.HealthChanged:Connect(function()
		if tag.Value == itemTable.LongSword.itemKey then
			bloodLossBool = false
			bloodLoss.Value += itemTable.LongSword.itemBld
			debugBlood.TextLabel.Text = bloodLoss.Value.. 'bleeding left'
			task.wait(1)
			bloodLossBool = true
		end
	end)
	while bloodLossBool do
		while bloodLoss.Value > 0 do
			task.wait(1)
			bloodLoss.Value -= 1
			print(bloodLoss.Value)
			bloodLoss.Value.Changed:Connect(function(newValue)
				if newValue > bloodLoss.Value then
					bloodLossBool = false
					bloodLoss.Value = bloodLoss.Value + newValue
					task.wait(1)
					bloodLossBool = true
				elseif bloodLoss.Value > newValue then
					bloodLossBool = false
					bloodLoss.Value = bloodLoss.Value - newValue
					task.wait(1)
					bloodLossBool = true
				end
			end)
			if bloodLoss.Value == 0 then
				bloodLoss.Changed:Wait()
			end
		end
		bloodLoss.Changed:Wait()
	end

hi, the system i make is suppose to go up by whatever the number is, and go down by 1. It works fine it just that the number goes up more. In the video, the players value was suppose to go up by 8. but it went up more. Please help me fix it

local bloodLoss = char:WaitForChild('BloodLoss') -- Assuming 'BloodLoss' is a NumberValue
local tag = char:WaitForChild('Tag') -- Assuming 'Tag' is a StringValue
local humanoid = ... -- Assuming you have a reference to the Humanoid object

local bloodLossBool = true

humanoid.HealthChanged:Connect(function()
    if tag.Value == itemTable.LongSword.itemKey then
        bloodLossBool = false
        bloodLoss.Value = math.max(0, bloodLoss.Value + itemTable.LongSword.itemBld)
        debugBlood.TextLabel.Text = bloodLoss.Value .. ' bleeding left'
        task.wait(1)
        bloodLossBool = true
    end
end)

while bloodLossBool do
    while bloodLoss.Value > 0 do
        task.wait(1)
        bloodLoss.Value = math.max(0, bloodLoss.Value - 1)
        print(bloodLoss.Value)
    end
    bloodLoss.Changed:Wait()
end

Hi, it is still going up more than what i expected.

Did you add a debounce?

30MoreCharacters

No. I dont know how i would implement that into my code here

Or actually maybe you could do this?

local bloodLoss = char:WaitForChild('BloodLoss')
local tag = char:WaitForChild('Tag')
local itemBld = itemTable.LongSword.itemBld
local maxBloodLoss = 8 -- Maximum allowed blood loss

local bloodLossBool = true 
humanoid.HealthChanged:Connect(function()
    if tag.Value == itemTable.LongSword.itemKey then
        bloodLoss.Value = math.min(bloodLoss.Value + itemBld, maxBloodLoss)
        debugBlood.TextLabel.Text = bloodLoss.Value .. ' bleeding left'
    end
end)

while bloodLossBool and bloodLoss.Value > 0 do
    task.wait(1)
    bloodLoss.Value = math.max(bloodLoss.Value - 1, 0)
end

Nope, still going up
30morecharsissocool

Also I want it to go up, just once every time they get hit

local bloodLoss = char:WaitForChild('BloodLoss')
local tag = char:WaitForChild('Tag')
local itemBld = itemTable.LongSword.itemBld
local maxBloodLoss = 8
local bloodLossBool = true

humanoid.HealthChanged:Connect(function()
    if tag.Value == itemTable.LongSword.itemKey then
        bloodLoss.Value = math.min(bloodLoss.Value + itemBld, maxBloodLoss)
        debugBlood.TextLabel.Text = bloodLoss.Value .. ' bleeding left'
    end
end)

while bloodLossBool and bloodLoss.Value > 0 do
    task.wait(1)
    bloodLoss.Value = math.max(bloodLoss.Value - 1, 0)
end

-- Ensure blood loss never exceeds the maximum allowed
bloodLoss:GetPropertyChangedSignal("Value"):Connect(function()
    if bloodLoss.Value > maxBloodLoss then
        bloodLoss.Value = maxBloodLoss
    end
end)

Wait, just up?

30morecharsissocool

Yes, im trying to make it go up by 8, my problem is that its adding more than 8