#Left & Right Click Detection
1 messages · Page 1 of 1 (latest)
you can't detect left click in scripts, but you can detect right click.
Documentation for @minecraft/server
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"
Would I be able to use an animation controller for the right clicking as well?
Thank you I'll try that out right away
Could I DM you a screenshot? I'm not entirely sure if I did it right
just send the screenshot here
The screenshot is for the animation controller not the scripts my bad, also it's not working
"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"
}
]
}
}
}
}
}```
So umm, is_using_item will only trigger on items that are usable like foods or bows
Just use script for that
Thank you
using OnPlace is basicly left click so you could always cancel a block being placed and run a command or whatever
ohh you're taking about using animation controller and detect that?
Not really a good way if your time is just an item not a placeable block
@spark holly