On Quit Keeps Looping and Not Quitting

I have been up all night trying to figure this out and I’m getting nowhere. This works exactly as I would like it to except when pressing Exit then Yes to quit, it loops back the same way it does when you press No. If someone can steer me in the right direction with this and help me with this annoyance I’d greatly appreciate it. I am not interested in doing the quit command without the on quit, as I need it like this to complete the rest of my project. The entire thing works flawless except this tiny flaw. Thanks again!

repeat
	tell application "System Events" to set theapps to the name of every application process whose visible is true and name is not "Finder"
	
	set selectedAPP to choose from list theapps cancel button name "Exit" with prompt "which Application?"
	set Falsify to result
	log Falsify
	if Falsify = false then --Cancel
		quit
		--if onQuit is "No"
	else --Selected App
		exit repeat
	end if
	--After onQuit is "No"
end repeat
set convertedName to application (selectedAPP as string) -- after "success"
display dialog "Okie dokie"

on quit
	display dialog "Are you sure you want to quit?" buttons {"Yes", "No"}
	set onQuit to button returned of the result
	if onQuit is "Yes" then
		continue quit
	else if onQuit is "No" then
	end if
end quit

Sorry I forgot to mention I’m running this as Stay Open so the application stays on rather than quits. Other sections of the script I’m working on quit no problem the way I have it written. It’s just this one piece that returns and doesn’t quit. I tried a suggestion of

 if onQuit is "Yes" then
                    error number -128 --> Cancel the script

and it cancels the script but the app stays open. Not sure why this is happening exactly. Sorry for forgetting to mention that.

Model: Macbook Pro 15" Late 2011 w/Mavericks
Browser: Safari 537.74.9
Operating System: Mac OS X (10.8)

Funny enough, my original plus the error number -128 in conjunction worked perfectly! Now it quits no problem! Yayy :slight_smile:

on quit
	display dialog "Are you sure you want to quit?" buttons {"Yes", "No"} 
	set onQuit to button returned of the result
	if onQuit is "Yes" then
		continue quit
		error number -128
	else if onQuit is "No" then
	end if
end quit