I hope you can tell what I'm trying to do here, more or less.

When I click the TextButton, it only makes it to print("i"), and the bool doesn't disable again.

Why is this? Please help.

local pugChangeEvent = game:GetService("ReplicatedStorage").PowerPugToggle
local bool = script.Parent.Parent.Activated

repeat wait() until game.Players.LocalPlayer
local p = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	print("click")
	if bool.Value == false then
		print("a")
		local p = game.Players.LocalPlayer
		print("b")
		if p then
			print("c")
			if p:FindFirstChild("IsAPug").Value == true then
				print("d")
				pugChangeEvent:FireServer(p)
				print("e")
				bool.Value = true
				print("f")
				p.Character.Humanoid.Died:Connect(function()
					print("g")
					bool.Value = false
					print("h")
				end)
				print("i")
				wait(1)
				print("j")
				bool.Value = false
				print("k")
			end
		end
	end
end)