Unexpected script error

Script is suddenly stops working at print(“3”) part. No errors or anything, changing head.value to the point of heavy bleeding when there are none bleedings it just keeps doing part with print(“3”). How I could solve that?

while wait(0.1) do
	if head.Value <= 80 then
		lightbleeding = true
		print("2")
	elseif head.Value >= 41 then
		lightbleeding = false
		print("1")
	end

	if lightbleeding == true then
		player.PlayerGui.MainGui.Frame.Health.ImageTransparency = 0
		BloodScreen:Play()
		print("3")

		while lightbleeding == true do
			wait(5)
			hum:TakeDamage(3)
		end
	elseif lightbleeding == false then
		player.PlayerGui.MainGui.Frame.Health.ImageTransparency = 1
		print("4")
	end
end
while wait(0.1) do
	if head.Value <= 40 then
		heavybleeding = true
		print("6")
	elseif head.Value >= 41 then
		heavybleeding = false
		print("5")
	end
	if heavybleeding == true then
		player.PlayerGui.MainGui.Frame.Health.ImageTransparency = 0
		player.PlayerGui.MainGui.Frame.LowHealth.ImageTransparency = 0
		BloodScreen:Play()
		BloodScreenLowHP:Play()
		print("8")
		
		while heavybleeding == true do
			wait(3)
			hum:TakeDamage(5)
		end
	elseif heavybleeding == false then
		player.PlayerGui.MainGui.Frame.Health.ImageTransparency = 1
		player.PlayerGui.MainGui.Frame.LowHealth.ImageTransparency = 1
		print("7")
	end
end

You are using while loops in your script, which pauses the script from running anything but what is inside the loops.

To demonstrate:

local Points = 0
local Debounce = false

while task.wait(0.1) do
    if not Debounce then -- if Debounce == false then
        Debounce = true
        while Debounce do -- Code loops here forever.
            Points += 1
            task.wait(1)
        end
    end
end

while true do -- Does not run as script is still stuck.
    task.wait(5)
    Debounce = false
    print(Points)
end

The script is stuck at a loop, and cannot do anything else until the conditions of the loop are broken.

Use Changed instead when changing the variables as soon as head.Value is updated like this:

head.Value.Changed:Connect(function()
    if head.Value <= 80 then
       lightbleeding = true
    end
end)

Changed is an event you can connect a function to when you want to detect any change of properties in an object.

No, use GetPropertyChangedSignal

Value instances may not have that too many properties to specifically detect variables with. They always only have a unique property that is AnyValue.Value. Either GetPropertyChangedSignal or Changed is fine.