I'm trying to make a weapon pick-up system where the player walks in an area2d and then has the option to press F to pickup the weapon that he is currently standing over. The code looks like this:
func _on_PickupArea_area_entered(area):
pickupText.show()
if Input.is_action_just_pressed("pick_up"):
print("hello")
weaponIndex = area.pickupIndex
weapon.hide()
weapon = WeaponContainer.get_child(weaponIndex)
weapon.show()
The problem is that when I actually play the game and press the key(F), nothing happens. The signal works properly since the pickupText shows as it is supposed to. To test this out, I tried putting the same code in the _process(): function and there it actually detects when I press the action so it seems like the problem has something to do with the signal. Is it not possible to use Input statements in a signal? If so, how else can I do this?