--Restore Default Settings

local restore = pages.custom["AX Restore"]
local loading = restore.Loading
local restoreDe = 0
restore.MouseButton1Down:Connect(function()
	if restoreDe < 2 then
		local h,s,v = Color3.toHSV(restore.BackgroundColor3)
		loading.BackgroundColor3 = Color3.fromHSV(h, s, v*0.5)
		loading.Visible = true
		if restoreDe == 0 then
			restoreDe = 1
			loading.Blocker.Visible = false
			loading.TextLabel.Text = "Confirm?"
			wait(1)
		elseif restoreDe == 1 then
			restoreDe = 2
			loading.Blocker.Visible = true
			loading.TextLabel.Text = "Loading..."
			local returnMsg = main.signals.RestoreDefaultSettings:InvokeServer()
			if returnMsg == "Success" then
				updateSettings()
				main:GetModule("PageCommands"):CreateCommands()
				local notice = main:GetModule("cf"):FormatNotice("RestoreDefaultSettings")
				main:GetModule("Notices"):Notice("Notice", notice[1], notice[2])
			else
				restore.TextLabel.Text = returnMsg
			end
			wait(1)
		end
		restoreDe = 0
		loading.Visible = false
		loading.Blocker.Visible = false
	end
end)
