Preventing Double Clicks (SOLVED)

So I have a game with GUI nodes that react to mouse clicks. When a node is clicked, a number will be outputted - which it does, but I see that the number gets outputted several times. How do I make it so a number will only be outputted once and not multiple times if a node is pressed (continuously)?

You can use a cooldown timer and check if it’s non zero.
If it is non zero, skip the click, if it is zero, accept the click.

1 Like

I will give it a try, thanks!

Are you checking if the click is pressed? (action.pressed)

1 Like

I have changed it to action.released after looking at How to set cooldown timer on shooting function? - Questions - Defold game engine forum and have adapted the code to suit my game.

3 Likes