#How to get commands to work per person in tick function

1 messages · Page 1 of 1 (latest)

rustic veldt
#
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
sinful sleetBOT
#

<@&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

lapis lion
#

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.

rustic veldt
#

thats purposefull

#

and its not the problem

lapis lion
#

Why is that intended?

#

I'm sure it does work in singleplayer, that doesn't contradict what I said

rustic veldt
lapis lion
#

...

rustic veldt
#

but it is meant tpo cleart all night vision

lapis lion
#

But why?

rustic veldt
#

nevermind

#

your right about that

#

but i need it to detect per player

lapis lion
#

That necessarily will make it so that if anyone isn't holding the item, everyone will lose night vision

#

Yeah

#

You already are

rustic veldt
#

but it dosn't work

lapis lion
#

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.

rustic veldt
#

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...

lapis lion
#

Yes

#

I am telling you, that is what you currently have

#

You just have the one mistaken target selector

rustic veldt
#

but its not working like that

lapis lion
#

...

rustic veldt
#

nevermid

#

you are right

sinful sleetBOT
# rustic veldt you are right
🎗️ 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

lapis lion
#

Try listening to helpers next time