How to stop input repeating

Godot Version

v4.7.stable.official [5b4e0cb0f]

Question

I’m trying to prevent my game from executing code multiple times when detecting input events. I did some research and it seems like I’m supposed to use Input.is_action_just_pressed() instead of event.is_action_pressed(). But both functions seem to have the same result, which is detecting the input 3 times, even when the key is pressed and released quickly.

func _input( event ):
	if Input.is_action_just_pressed("TextForward"):
		print("INPUT: TextForward")
		Signals.emit_signal("updateDialogue")

This results in the print statement being sent to output 3 times whenever the “TextForward” key is pressed. What am I doing wrong here?

Try to move your code inside the _process function instead and see if the problem still persists. Since you are not making use of the actual event anyway, you’re only using the Input class directly.

Yeah, that fixes it, thanks!