unjustified pause in script


on run_JW_lua_file(fileLoc, menuName, appName)
    if fileLoc begins with "~" then
        set fileLoc to (POSIX path of (path to home folder)) & text 3 thru -1 of fileLoc
    end if
    
    try -- try to find it in the plugin folder first...
        menu_click({appName, "Plug-ins", "JW Lua", menuName})
    on error -- if not, do it with jw lua
        set the clipboard to (read fileLoc)
        try
            menu_click({appName, "Plug-ins", "JW Lua", "JW Lua..."})
            win_wait_active("JW Lua", appName)
            tell application "System Events"
                tell process appName
                    tell window "JW Lua"
                        click radio button "Development" of radio group 1
                        delay 0.2
                        keystroke tab
                        delay 0.2
                        keystroke "a" using command down
                        delay 0.2
                        keystroke "v" using command down
                        tell button "Run Script" to click
                        delay 0.2
                        tell button "Close" to click
                    end tell
                    delay 0.2 ------------------------RIGHT HERE-------------- It takes 5 seconds before it executes the next part
                    tell window 1
                        tell button "No" to click
                    end tell
                end tell
            end tell
        on error -- doesn't even have JW Lua
            display dialog "You don't have \"JW Lua...\" in a folder named \"JW Lua\" in the plugins folder or something else failed...."
        end try
    end try
end run_JW_lua_file

For some reason this script just seems to act as if there is a delay 5.0 somewhere (inexact). I used to use it on another comp and I don’t remember it pausing then.

I initially thought it might be the tell window 1 part (an unnammed window, which used to work) but replaced it with a send keycode ESC type of command and it still took around 5 seconds before it did ‘that’

Any thing that could be instigating it?

EDIT: Also, why do my code blocks not branch out?? I used to use tabs and it does this even with spaces…?