Hello.
There's no cooldown on logout function.
LUA doesn't runs two functions at the same time. On your script, it will run logout and after logging out then it will print, flashclient() and finally playsound().
I don't know if that is the case, but if you have Battle sign or if you hit a GFB rune on your screen (you will have a battle sign) then will not be able to logout.
Although part of your logic is correct, it would be in a perfect world, but you have not considered the runtime for example. If you create a script that is 50ms apart, but takes 3s to execute the code. It will not run every 50ms, but every 3050ms. The persistent interval is applied after the script has finished running.
The logout() function returns true / false. True if the character is offline after executing the function and false otherwise. You can use a while loop with the function return or even check for yourself using the connected() function.
if paround() > 0 then
while not logout() do
wait(100, 200)
end
end
OR
if paround() > 0 then
while battlesigned() == false and connected() do
logout()
wait(100, 200)
end
end