#Left & Right Click Detection

1 messages · Page 1 of 1 (latest)

red flax
#

I've never used scripts and don't know how to create this

When a player left clicks a specific custom item it sets their scoreboard value to zero

When a player right clicks a specific custom item it sets their scoreboard value to zero

If there's another solution that doesn't use scripts I'd be open to it

feral torrent
#

for left click detection you need a behavior animation controller, and you make an animation checking for "variable.attack_time"

#

then you can run a command in "on_entry"

red flax
red flax
red flax
feral torrent
red flax
red flax
# red flax
    "format_version": "1.10.0",
    "animation_controllers": {
        "variable.attack_time": {
            "initial_state": "false",
            "states": {
                "false": {
                    "on_entry": ["/scoreboard players set @s leftClick 0"],
                    "transitions": [
                        {
                            "true": "variable.attack_time"
                        }
                    ]
                },
                "true": {
                    "on_entry": ["/scoreboard players set @s leftClick 1"],
                    "transitions": [
                        {
                            "false": "!variable.attack_time"
                        }
                    ]
                }
            }
        },
        "is_using_item": {
            "initial_state": "false",
            "states": {
                "false": {
                    "on_entry": ["/scoreboard players set @s rightClick 0"],
                    "transitions": [
                        {
                            "true": "q.is_using_item"
                        }
                    ]
                },
                "true": {
                    "on_entry": ["/scoreboard players set @s rightClick 1"],
                    "transitions": [
                        {
                            "false": "!q.is_using_item"
                        }
                    ]
                }
            }
        }
    }
}```
stiff mica
#

Just use script for that

earnest tree
#

using OnPlace is basicly left click so you could always cancel a block being placed and run a command or whatever

stiff mica
#

Not really a good way if your time is just an item not a placeable block