Radial Menu won't animate correctly

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

I have created a radial menu that is made to select different items. It uses keyboard input to allow a user to select an adjacent item that is clockwise or counterclockwise to their currently selected item. In the code and computationally this concept is represented by going left or right on an array of child nodes. The actual selection of the correct slot is perfectly functional. But the animations are messed up if the user spams the button. I have tried delaying user input using a timer but it just didn’t work. The setup for the menu is that there are a series of animated sprites that serve as weapon slots who’s position is in a radial configuration. They start in “closed” state where the sprite is small. Then, when a weapon is selected the animation for the slot is played telling the user that this slot is the one they have selected. Then when the user selects another weapon slot the currently used weapon slot has it’s “closing” animation played. However, when the user spams the input(like if they were in a fight) then the animations go wild and multiple weapon slots take on the appearance of being selected even though they are not the currently active weapon slot. I need some help with the code that is posted below since I just can’t figure out the problem. (I can post any additional information needed.)

func _physics_process(_delta):
	if Input.is_action_just_pressed("change_weapon_left") and weapon_wheel.visible:
		change_weapon(-1)
	if Input.is_action_just_pressed("change_weapon_right") and weapon_wheel.visible:
		change_weapon(1)

func change_weapon(direction):
	slot_sprites.get_child(selected_weapon).play("hide")
	yield(slot_sprites.get_child(selected_weapon), "animation_finished")

	if direction < 0:
		if selected_weapon == 0:
			selected_weapon = 7
		else:
			selected_weapon -= 1
	else:
		if selected_weapon == 7:
			selected_weapon = 0
		else:
			selected_weapon += 1

	slot_sprites.get_child(selected_weapon).play("show")
	yield(slot_sprites.get_child(selected_weapon), "animation_finished")
:bust_in_silhouette: Reply From: Noddy

The first yield in change_weapons was causing the issue. After deleting it the animations worked perfectly.