So, I have two problems with this script. First of all, when I go and I activate the nuke with the code, it activates, I deactivate it with the code, and it works. But then if I go to resume it, it just cancels again. Secondly, when I wait for the nuke to go off, and it sets off the function killEveryone() , it does nothing.

Code = "2323" --change To any numbers You like
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 time.Position == 101 then
				killEveryone()
			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
			NukeOn = true
			wait(35)
			if DResumed.TimePosition == 35 then
				killEveryone()
			end
		end
	end
end

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


function Click0()
Input = Input..0
end

script.Parent.B0.MouseButton1Down:Connect(Click0)

function Click1()
Input = Input..1
end

script.Parent.B1.MouseButton1Down:Connect(Click1)

function Click2()
Input = Input..2
end

script.Parent.B2.MouseButton1Down:Connect(Click2)

function Click3()
Input = Input..3
end

script.Parent.B3.MouseButton1Down:Connect(Click3)

function Click4()
Input = Input..4
end

script.Parent.B4.MouseButton1Down:Connect(Click4)

function Click5()
Input = Input..5
end

script.Parent.B5.MouseButton1Down:Connect(Click5)

function Click6()
Input = Input..6
end

script.Parent.B6.MouseButton1Down:Connect(Click6)

function Click7()
Input = Input..7
end

script.Parent.B7.MouseButton1Down:Connect(Click7)

function Click8()
Input = Input..8
end

script.Parent.B8.MouseButton1Down:Connect(Click8)

function Click9()
Input = Input..9
end

script.Parent.B9.MouseButton1Down:Connect(Click9)

4 comments

0

Is this your own script, cause it seems like it isnt. If it isnt then you came to the wrong place, try making your own script then asking for help if you encounter a problem. On the other hand if this is your script as I commented before Sound.TimePosition only updates while a sound is stopped. Thus the nuke wont go off.

0

This is my own script. Also, I fixed it, and this helped me. But now, I have to make another question as I have a new problem. I am going to lose my mind making this script. It's almost done. It's always one error left. But then when I fix that error, all of a sudden another one pops up out of nowhere.

0

Note: It has some used parts to it from other scripts that I had saved for other things.

0

For example, the functions that change the input and the clear are from another script. Also the first two locals.