When making scripts, you should always try to keep them organized. The script you posted looked like a block of text to me, and I wouldn't be surprised if you missed a ; or two
On the topic of friendly disguises, they are actually quite useful. Jumping into the enemies base while disguised as a friendly medic can make them think there isn't a spy (while you feign and redisguise elswehere). I also find it quite fun to disguise as a friendly scout and backstab people, they usually never expect you to suddenly stop and backstab and will continue to try to lead ahead of you.