How to allow the player to choose only one checkbox? URGENT PLS

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

Guysss i need help with this code
ive made a game where we are choosing items for the adventure but as of now
the player is able to choose as many as he wants how can i restrict it to only one checkbox

ive made 3 checkbox’s under the Vbuttonarray and then made a variable item for the vbuttonarray node get the children and then if the var is pressed add the item to the inventory

func fill_inventory():
var items = levelMenu.get_node("Items")
for item in items.get_children():
	if item.is_pressed:

DIsable them once the player has chosen one? Deselect all others when the player chooses one?

SteveSmith | 2023-01-02 12:50

:bust_in_silhouette: Reply From: SQBX

Make the checkboxes part of same button group. They then become radio buttons.

It’s the Group attribute under the checkbox node inspector.

You have to save it for the first button then load it for the other(s).

Bro I really dont get it can you explain it with code btw i tried this and it is not working any ideas:
func fill_inventory(): game.clear_items() var Hammer = levelMenu.get_node("Items/Hammer") var MedKit = levelMenu.get_node("Items/MedKit") var Minigun = levelMenu.get_node("Items/Minigun") #var items = levelMenu.get_node("Items") #for item in items.get_children(): #if item.is_pressed: #game.add_item(item.get_name()) if Hammer.pressed: MedKit.pressed = false Minigun.pressed = false if MedKit.pressed: Hammer.pressed = false Minigun.pressed = false if Minigun.pressed: MedKit.pressed = false Hammer.pressed = false

Ty | 2023-01-03 11:51