js on gameplay switch working