Author Topic: How to make a button that you can't spam click on?  (Read 623 times)

When you have a button...

OnActivate -> Self -> playSound -> [Soundhere]

It's a good deal but...

Spam clicking button = Ear raper

Is there someway to make this so when you click on it you can only click it again after a certain time?

If I'm blind and I'm missing something super obvious, then I don't blame you. :cookieMonster:

5000 onActivate > Self > setEventEnabled > 0 1 2 ☒
0 onActivate > Self > playSound...
0 onActivate > Self > setEventEnabled > 0 1 2 ☐

This will make the event disable itself after being clicked, but 5 seconds later the first event will enable it again.

A much easier way is to disable raycasting

0 onActivate > Self > setRaycasting ☐
5000 onActivate > Self > setRaycasting ☒
0 onActivate > ....

Then you don't have to put in all the event numbers you want to block.
But both ways work.

But then you can fire bullets through the brick.


5000 onActivate > Self > setEventEnabled > 0 1 2 ☒
0 onActivate > Self > playSound...
0 onActivate > Self > setEventEnabled > 0 1 2 ☐

This will make the event disable itself after being clicked, but 5 seconds later the first event will enable it again.
was helping somebody else with this in a different topic

the issue with just doing this is it can break if the events are canceled (minigame leaving/disconnecting/saving while the events are running)
if you want it to be self correcting, I've put together this
Code: [Select]
0 OnActivate -> Self -> dostuff (play sound)
0 OnActivate -> Self -> setEventsEnabled 0 1 2 false
2000 onActivate -> Self -> setEventsEnabled 0 1 2 true
5000 onActivate -> self -> fireRelay
0 onRelay -> self -> setEventsEnabled 0 1 2 true
the 2000 is the normal delay (2 seconds, can be changed)
the 5000 is the self correcting reset (5 seconds, must be more than the normal delay)

since starting a relay cancels other relays, the reset can't be spammed and will always work even if the other events are disabled, but won't reset the event before the normal usage resets itself (the events won't flash on/off)