How to create a list that has many options, but I can only select exactly 4?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By PedroHGS

I’m creating a game in which I need to create a list of colors, but the player can only choose 4 colors at once, how can I do that?

obs: I’ve tried ItemList and PopupMenu so far, and both didn’t work as intended yet… And if you guys know any other way of doing it please feel free to share

:bust_in_silhouette: Reply From: aipie

Would four separate colorpickerbuttons or colorpickers nodes help in your case?
This does mean that the same color could be chosen.

:bust_in_silhouette: Reply From: exuin

You could try creating a list yourself with a bunch of buttons. Just keep track of which ones are selected and if more than four are selected, deselect the latest one.

:bust_in_silhouette: Reply From: PedroHGS

I’ve already solved it. I’ve created 4 OptionButtons, that will accept only one color option each, and created an error message that shows up everytime two or more buttons have the same option checked :slight_smile: Idon’t know if it’s the best solutions, but it has been working fine so far.

But anyway, thanks for the great ideas and investing your time on helping me.