How to make an action confirmation Gui?

Depends on how long & where you’re wanting to put it, you could also insert a TextLabel to change the text when you activate the button:

local Activated = false
local Cooldown = 60
local TextLabel = script.Parent.TextLabel --If you want

local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local button = script.Parent
local confirmGui = PlayerGui:WaitForChild("ConfirmAction")
local yesButton = confirmGui.Yes
local noButton = confirmGui.No

print("Script Online")
button.MouseButton1Down:Connect(function()
    if Activated == false then --This will just check if you've activated the tool, if you have then it'll only be activated once and you can't use it anymore
        print("Activated")
        Activated = true
        confirmGui.Enabled = true
    end
end)

yesButton.MouseButton1Down:Connect(function()
    print("Yes")
    game.ReplicatedStorage.SendWebhook:FireServer()
    confirmGui.Enabled = false

    for Loop = Cooldown, 0, -1 do
        print("Time remaining: "..tostring(Loop))
        TextLabel.Text = tostring(Loop)
        wait(1) 
    end
    Activated = false
    print("Ready")
end)

noButton.MouseButton1Down:Connect(function()
    print("No")
    confirmGui.Enabled = false
    Activated = false
end)
1 Like

this seems to break it and there is no error in output

1 Like

Are you sure…? I added a couple of print statements, try it again :thinking:

1 Like

The countdown starts before the user has confirmed to call a mayday

1 Like

T h e h e c k w h a t

Even when you didn’t hit the button, it still counted down…?

1 Like

Didn’t even press the button and it counted,

1 Like

It started as soon as I opened up the confirmGui

1 Like

Wait so you want it- Ok I think I know what you’re getting at:

Try the script again?

1 Like

I want it so once you press Yes it starts counting

1 Like

This is the script so far:

local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local button = script.Parent
local confirmGui = PlayerGui:WaitForChild("ConfirmGui")
local yesButton = confirmGui.Frame.Yes
local noButton = confirmGui.Frame.No

local Activated = false
local Cooldown = 500
local TextLabel = confirmGui.Frame.Countdown --If you want

print("Script Online")
button.MouseButton1Click:Connect(function()
	if Activated == false then 
		print("Activated")
		Activated = true
		confirmGui.Enabled = true
		for Loop = Cooldown, 0, -1 do
			print("Time remaining: "..tostring(Loop))
			TextLabel.Text = tostring(Loop)
			wait(1) 
		end
		Cooldown = 60
		Activated = false
		print("Ready")
	end
end)

yesButton.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.SendWebhook:FireServer()
	confirmGui.Enabled = false
end)

noButton.MouseButton1Click:Connect(function()
	confirmGui.Enabled = false
end)
1 Like

Ok if this doesn’t work then idk what else I can really do for you, scroll back I updated it

1 Like

ok it works apart from that after you submit a mayday you cant open the menu

1 Like

how do i fix that and the countdown text timer doesnt work now either

1 Like

@JackscarIitt please help, i don’t know whats up

1 Like

Can you check the Output? Is there anything printing there at all?

1 Like

yes the printing works perfectly

1 Like

@JackscarIitt It’s perfect apart from the fact that the timer starts when you open it and not when you press Yes.

1 Like

Weird, could you try again? I changed your MouseButton events a bit, and added a couple more prints

2 Likes

It works apart from that when you press Yes, you cannot open the menu again to see how long is on the timer.

1 Like

I think I know the reason

Since you’re disabling the GUI entirely, it’s also disabling the Timer Text as well which is making it invisible to you as it’s a descendant of the entire ScreenGui object

For this:

I have no clue why that isn’t working, it is printing Ready after waiting for it to cooldown, right?

1 Like