How to use Mouseinput?

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

I want to print Hello, if the right mouse button is pressed

:bust_in_silhouette: Reply From: jgodfrey

Here’s one way. Add this function to a scene script and run it:

func _input(event):
	if event is InputEventMouseButton \
	and event.button_index == BUTTON_RIGHT \
	and event.pressed: