#Button events

1 messages · Page 1 of 1 (latest)

chrome wren
#

So, I have a bamboo button in the overworld. How can I know when the button is pressed? I used the buttonPush event from afterEvents for the overworld, and the problem is, it stays on for too long. So, if I do a function in that event, it loops again and again till the button comes back to its original position. How do I make it so that the function is called only once?

merry rivet
#

Destroying the button?

dire pelican
#

tag the player?

if (!player.hasTag('clicked')) {
   player.addTag('clicked')
   //code here
   system.runTimeout(()=>{
      player.removeTag('clicked')
   },30) //30 tick, cus button stays activated for 1.5 seconds
}```
#

or just add return at the end of the code

merry rivet
#

There are many ways to do that.