The function CountTillRace makes no sense, you mixed up switch and else. You should better do some scripting tutorials before asking specific questions.
Well you should try to make sence. that's fully work i mean this code works . You had better to do soem thing in this edition , dont talk useless