Why doesn't the loop break?

This script has 2 countdowns, one from 30 and one from 6. Once the countdown from 30 reaches 0 it’s supposed to go back to 6 for the second countdown and it does that perfectly fine. The problem is on the second countdown when the loop is supposed to break. It’s meant to break once the value hits 0 but instead of breaking, it just keeps going and into the negatives.

local bool = script.Parent.Parent.Parent.Parent.PlayerIn
local text = script.Parent.Parent

bool.Changed:Connect(function()
	if bool.Value == true then
		text.Visible = true
while true do
	script.Parent.Value = script.Parent.Value - 1
			if script.Parent.Value == 0 then
				script.Parent.Value = 6
				while true do
					script.Parent.Value = script.Parent.Value - 1
					if script.Parent.Value == 0 then
						bool.Value = false
						break
					end
					wait(1)
				end
			end
		wait(1)
		end
	end
end)

So, you have two nested while loops.

Using break in the second loop will only get your out of that second loop. You are not breaking out of the first loop, which will keep going, and keep subtracting by one every time.

An example of something you could do to mitigate this issue would be:

local bool = script.Parent.Parent.Parent.Parent.PlayerIn
local text = script.Parent.Parent

bool.Changed:Connect(function(newValue)
	if newValue then
		text.Visible = true
		local resetCounter = false
		while task.wait(1) do
			script.Parent.Value = script.Parent.Value - 1
			if script.Parent.Value == 0 then
				if not resetCounter then
					script.Parent.Value = 6
					resetCounter = true
				else
					bool.Value = false
					break
				end
			end
		end
	end
end)

do this:

local bool = script.Parent.Parent.Parent.Parent.PlayerIn
local text = script.Parent.Parent

bool.Changed:Connect(function()
	if bool.Value == true then
		text.Visible = true
while true do
	script.Parent.Value = script.Parent.Value - 1
			if script.Parent.Value == 0 then
				script.Parent.Value = 6
				while true do
					script.Parent.Value = script.Parent.Value - 1
					if script.Parent.Value == 0 then
						bool.Value = false
						    break
					end
					wait(1)
				end
                break
			end
		wait(1)
		end
	end
end)

I added another break