title @a times 0 20t 0
execute as @a if data entity @s Inventory[{id:"minecraft:carrot_on_a_stick",Slot:-106b,components:{"minecraft:custom_name":'{"color":"dark_green","italic":false,"text":"Night Vision Goggles"}'}}] run title @s title {"text":"a","font":"filter:fill","color":"#009105"}
execute as @a if data entity @s Inventory[{id:"minecraft:carrot_on_a_stick",Slot:-106b,components:{"minecraft:custom_name":'{"color":"dark_green","italic":false,"text":"Night Vision Goggles"}'}}] run effect give @s night_vision 1 0 true
execute as @a unless data entity @s Inventory[{id:"minecraft:carrot_on_a_stick",Slot:-106b,components:{"minecraft:custom_name":'{"color":"dark_green","italic":false,"text":"Night Vision Goggles"}'}}] run title @a reset
execute as @a unless data entity @s Inventory[{id:"minecraft:carrot_on_a_stick",Slot:-106b,components:{"minecraft:custom_name":'{"color":"dark_green","italic":false,"text":"Night Vision Goggles"}'}}] run effect clear @a night_vision``` I need these commands to work per person but currently if one person puts it in their offhand nothing happens, and everyone has to put in their offhand for it to work, how do I get it so it works per person
#How to get commands to work per person in tick function
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
Someone will come and help soon!
💬 While you wait, take this time to provide more context and details.
🙇 If nobody has answered you by <t:1742165230:t>, feel free to use the Summon Helpers button to ping our helper team.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
Based on this code, that is not currently how it works.
The reason that appears to be happening is because your last command is doing effect clear @a night_vision, not effect clear @s night_vision like the others.
Why is that intended?
I'm sure it does work in singleplayer, that doesn't contradict what I said
you didnt let me finish
...
but it is meant tpo cleart all night vision
But why?
That necessarily will make it so that if anyone isn't holding the item, everyone will lose night vision
Yeah
You already are
but it dosn't work
You're just mistakenly clearing night vision from all players instead of just the one that isn't holding the item
Once you change that @a to @s, like I've been saying, it should work fine
Probably for the title command above that as well.
i need it so if one perosn has it in their off hand it orks for them, and if anoyther perosn has it in their offhand it works for them ect...
Yes
I am telling you, that is what you currently have
You just have the one mistaken target selector
but its not working like that
...
🎗️ Is your question resolved?
If your question is resolved, that's great to hear! Make sure to run /resolve or click the Resolve Question button. Otherwise, feel free to continue asking for help! :D
Try listening to helpers next time