RGB LEd and a push button in TinkerCAD
please tell me what's wrong.


I'm sorry to say, but pretty much everything. You need to rethink your program flow from the ground up.

Separate out the button from the LED actions. The button should only control the counter. The counter then makes the decision what to do with the LEDs.

Also you have to learn about the concept of change with the button. You don't want to be doing something if the button is high, since that will be being done all the time the button is pressed. Instead you need to learn how to do something only at the moment the button changes from low to high.

As a rough outline to how your program could look, here's a pseudo-listing:


Set the counter to 0
If the button changes from LOW to HIGH


Increment the counter

If the counter is greater than 3


Set the counter to 1



That would give you a sequence of 0-1-2-3-1-2-3-1-2-3 for the counter as you press the button.

Next you have a separate section in your loop to deal with what the counter is.


If the counter is 0


Turn off all LEDs

If the counter is 1


Control the red LED and turn off the others

If the counter is 2


Control the green LED and turn off the others

If the counter is 3


Control the blue LED and turn off the others



If you implement that properly you will have created a finite state machine.