How to register mouse clicks properly?

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

I’m new to game design, so for my first game, I decided to make a clicker game. The clicking works so far, but sometimes will register multiple clicks at once, and I was wondering if there was a way to fix that. Here’s the snippet involving the code if you need it.

func _on_Cursor_input_event(_viewport, _event, _shape_idx):
if Input.is_action_just_pressed("click"):
	clicks += click_value
:bust_in_silhouette: Reply From: zhyrin

If there are multiple objects in your scene that have this code, more than one of them could run this code.

This is the only object that uses this code. but thank you for the response

shadowkeeper47258 | 2023-03-16 20:55