Need help with dictionary update value 😥

Godot Version



I would to change the value of a dictionary

func send_choice_from_client_to_serv(id : int, choice : String):
	var childrens = get_children()
	for child in childrens:
		if child is GameModel:
			for key in child.clients:
				if key == id:
					var value = child.clients[key]
					value["client_choice"] = choice


{client_id_1 :  {"client_choice" : null, "score" : 0}, client_id_2 :  {"client_choice" : null, "score" : 0}}

The function pass only 1 time in the “if key == id” and it’s correct but.
if i make

send_choice_from_client_to_serv(id_client_1, "ABC")

The result woul’d be

{client_id_1 :  {"client_choice" : "ABC", "score" : 0}, client_id_2 :  {"client_choice" : "ABC", "score" : 0}}

It’s update both and that’s not good
Please help :disappointed_relieved::disappointed_relieved:

Are you sure the dictionaries in child.clients are distinct and not just a reference to the same dictionary?