Code = "2323"
Input = ""
local NukeOn = false
local NukeResumable = false
local DActivated = game.Workspace.NukeSounds.DetonationActivated
local DCanceled = game.Workspace.NukeSounds.DetonationCanceled
local DResumed = game.Workspace.NukeSounds.DetonationResumed

local function killEveryone()
    local allPlayers = game.Players:GetChildren()
    for i = 1, #allPlayers do
        allPlayers[i].Character.Humanoid.Health = 0
    end
end

function Clear()
Input = ""
end

script.Parent.Clear.MouseButton1Down:Connect(Clear)




function Enter()
	if Input == Code then
		if NukeOn == false and NukeResumable == false then
			NukeOn = true
			DActivated:Play()
			wait(101)
			if DActivated.IsPlaying == true then
				killEveryone()
				NukeOn = false
			end
		end
	end
end

script.Parent.Enter.MouseButton1Down:Connect(Enter)

function Enter2()
	if Input == Code then
		if NukeOn == true then
			DActivated:Stop()
			DResumed:Stop()
			NukeOn = false
			NukeResumable = true
			DCanceled:Play()
		end
	end
end

script.Parent.Enter.MouseButton1Down:Connect(Enter2)

function Enter3()
	if Input == Code then
		if NukeOn == false and NukeResumable == true then
			DResumed:Play()
			NukeResumable = false
			wait(.1)
			NukeOn = true
			wait(35)
			if DResumed.IsPlaying == true then
				killEveryone()
			end
		end
	end
end

script.Parent.Enter.MouseButton1Down:Connect(Enter3)
------------------------------------------
--Digets


script.Parent.B0.MouseButton1Down:Connect(function()
	Input = Input.."0"
end)

script.Parent.B1.MouseButton1Down:Connect(function()
	Input = Input.."1"
end)

script.Parent.B2.MouseButton1Down:Connect(function()
	Input = Input.."2"
end)

script.Parent.B3.MouseButton1Down:Connect(function()
	Input = Input.."3"
end)

script.Parent.B4.MouseButton1Down:Connect(function()
	Input = Input.."4"
end)

script.Parent.B5.MouseButton1Down:Connect(function()
	Input = Input.."5"
end)

script.Parent.B6.MouseButton1Down:Connect(function()
	Input = Input.."6"
end)

script.Parent.B7.MouseButton1Down:Connect(function()
	Input = Input.."7"
end)

script.Parent.B8.MouseButton1Down:Connect(function()
	Input = Input.."8"
end)

script.Parent.B9.MouseButton1Down:Connect(function()
	Input = Input.."9"
end)

So basically where this all goes wrong is, when I initiate the detonation, cancel the detonation, and then resume the detonation, the sounds for resuming and initiating detonation both play at the same time, even though I set functions to stop this. Why is this happening? EDIT: So it's something between the three Enter functions. (Enter, Enter2, and Enter3, A.K.A. Lines 25-68) I believe. But, I don't know which, and where.