I’ve made a switch inside one of my GUI buttons. How do I set it up so that every click will increment the int value so it switched from case to case? And after it reaches 3 or more it’ll reset back to zero.
Here’s a snippet:
if(bgChange>4)
{bgchange = 1;}
switch(bgChange++)
{
case 1:
print("background02");
break;
case 2:
print("background03");
break;
case 3:
print("background04");
break;
default:
print("background01");
break;
}
At the moment, it goes up to 3 and back to 1 and it stops there. Sorry if this question sounds rush
that code looks more or less right, except for a typo: bgchange is not the same thing as bgChange With that fixed, though, it probably still doesn’t do quite what you want; you’ll never see case 1, since you set bgChange to 1 then immediately increment it.